#include using namespace std; #ifdef DEBUG #define display(x) cerr << #x << " = " << x << endl; #define eprintf(...) fprintf(stderr, __VA_ARGS__) #else #define display(x) {} #define eprintf(...) do {} while(0) #endif template bool chmin(T &a, const T &b) { return a > b ? a = b, true : false; } template bool chmax(T &a, const T &b) { return a < b ? a = b, true : false; } template ostream& operator << (ostream& out, const vector &v) { int n = v.size(); out << "{"; for(int i = 0; i < n; ++i) { if(i) out << ", "; out << v[i]; } return out << "}"; } template ostream& operator << (ostream& out, const pair &v) { return out << "(" << v.first << ", " << v.second << ")"; } typedef long long LL; typedef pair pii; void solve() { int n, m; cin >> n >> m; int ans = 100 * 100000 + 5; for(int i = 0; i < n; ++i) { int x, y; cin >> x >> y; chmin(ans, (m + x - 1) / x * y); } cout << ans << '\n'; } int main() { #ifndef LOCAL ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #endif int T; cin >> T; while(T--) solve(); return 0; }