#include #include #include using namespace std; int n, m, ans; const int INF = 0x7fffffff; void work() { cin >> n >> m; ans = INF; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; ans = min(ans, (m + x - 1) / x * y); } cout << ans << endl; } int main() { ios::sync_with_stdio(false); int T; cin >> T; while (T--) work(); return 0; }