#include using namespace std; const int maxn=11234; int cas,n,m,res,x[105],y[105]; int main() { cin>>cas; while (cas--) { scanf("%d%d",&n,&m); for (int i=1;i<=n;++i) scanf("%d%d",&x[i],&y[i]); int res=0x3f3f3f3f; for (int i=1;i<=n;++i) res=min(res,(m+x[i]-1)/x[i]*y[i]); printf("%d\n",res); } return 0; }