#include #include #include #include #include #include using namespace std; void process() { int n, m; cin >> n >> m; int ans = -1; for (int i = 0; i < n; ++i) { int x, y; cin >> x >> y; int t = (m + x - 1) / x * y; if (ans == -1 || t < ans) ans = t; } cout << ans << endl; /* int n; cin >> n; vector nums(n); string s; // NOTE: if using getline() to read the input, the following two lines should be // added to read the line sepeartor in the first line. getline(cin, s); getline(cin, s); stringstream S(s); */ } int main(void) { int T; cin >> T; for (int i = 1; i <= T; ++i) { process(); } return 0; }