#include #include #include #include const int Max = 100 * 100 * 100 + 5; #define LL long long LL mod = 1e9+7; const int INF = 1e5; //const int inx = INT_MAX; using namespace std; // srand(time(NULL)); // m = rand() % 1000 + 1; //定义i i(A) i+n i+n(B) i+n+n i+n+n(C) //bitsets,q; //int a[100],n; int main() { int i,j,t,a[105],b[105],n,m; cin >> t; while(t--){ cin >> n >> m; for(i = 1; i <= n; i++) cin >> a[i] >> b[i]; for(i = 1; i <= n; i++){ if(m % a[i] == 0){ a[i] = m / a[i]; b[i] = a[i] * b[i]; } else { a[i] = m / a[i] + 1; b[i] = a[i] * b[i]; } } int ans = 100000000; for(i = 1; i <= n; i++){ ans = min(ans,b[i]); } cout << ans << endl; } return 0; }