#include #define mst(a,b) memset(a,b,sizeof(a)) #define lowbit(x) ((x)&(-x)) #define X first #define Y second #define lc o<<1 #define rc o<<1|1 using namespace std; typedef long long LL; typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef pair pdd; typedef pair pll; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const int maxn = 2000+10; const int maxm = 100000+10; const int mod = 1e9+7; const double eps = 1e-8; int main() { #ifdef local freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); #endif ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int T; cin>>T; while (T--){ int n,m; cin>>n>>m; int ans=inf; for (int i=0;i>x>>y; int k=m/x; if (m%x) k++; ans=min(ans,k*y); } cout<