#include using namespace std; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int test; cin >> test; while (test--) { int n, m; cin >> n >> m; int res = 1 << 30; for (int i = 0; i < n; ++i) { int x, y; cin >> x >> y; res = min(res, ((m - 1) / x + 1) * y); } cout << res << '\n'; } }