#include using namespace std; const int N=1000005; int t,n,m,i,dp[10105],j; struct str{ int x,y; }a[N]; int main(){ scanf("%d",&t); while(t--) { scanf("%d %d",&n,&m); int ans=1<<30; for(i=1;i<=n;++i) { scanf("%d %d",&a[i].x,&a[i].y); ans=min(ans,(m+a[i].x-1)/a[i].x*a[i].y); } cout<