#include #define fo(i,a,b) for(int i=a;i<=b;i++) #define fod(i,a,b) for(int i=a;i>=b;i--) #define me0(a) memset(a,0,sizeof(a)) #define me1(a) memset(a,-1,sizeof(a)) #define op freopen("in.txt", "r", stdin) #define pii pair #define mp(x,y) make_pair(x,y) using namespace std; const int INF = 0x3f3f3f3f; typedef unsigned long long ULL; typedef long long LL; void read(int& val) { int x = 0; int bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; } const int mod=998244353; const int maxn=1e6+10; int main(){ int t,n,m,x,y; read(t); while(t--){ read(n);read(m); int ans=INF; fo(i,1,n){ read(x);read(y); int tt = m/x; if(m%x) tt++; ans=min(ans,tt*y); } printf("%d\n",ans); } return 0; }