#pragma GCC optimize(2) #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pairPLL; typedef pairPII; typedef pairPDD; #define I_int ll #define modl 19260817*19890604-19491001 inline ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } char F[200]; inline void out(I_int x) { if (x == 0) return (void) (putchar('0')); I_int tmp = x > 0 ? x : -x; if (x < 0) putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0) putchar(F[--cnt]); //cout<<" "; } const int maxn=11000; int x[maxn],y[maxn]; int main(){ int T=read(); while(T--){ int n=read(),m=read(); for(int i=1;i<=n;i++) x[i]=read(),y[i]=read(); int minn=1e9; for(int i=1;i<=n;i++){ int tmp=m/x[i]; if(m%x[i]) tmp++; minn=min(minn,tmp*y[i]); } cout<