#include #include #include #include #include #include using namespace std; int main() { int t,n,m,ans,x,y; scanf("%d",&t); while (t--) { scanf("%d%d",&n,&m); ans=100000000; while (n--) { scanf("%d%d",&x,&y); ans=min(ans,(m/x+(m%x!=0))*y); } printf("%d\n",ans); } return 0; }