#include using namespace std; int test,x,y,ans,n,m; int main() { scanf("%d",&test); while(test--) { scanf("%d%d",&n,&m);ans=1e9; for (int i=1;i<=n;i++) { scanf("%d%d",&x,&y); ans=min(ans,(m+x-1)/x*y); } printf("%d\n",ans); } return 0; }