#include int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; std::cin >> t; while (t--) { int n, m; std::cin >> n >> m; int ans = std::numeric_limits::max(); for (int i = 0; i < n; ++i) { int x, y; std::cin >> x >> y; ans = std::min(ans, (m + x - 1) / x * y); } std::cout << ans << "\n"; } return 0; }