#include using namespace std; int main() { ios::sync_with_stdio(false); int test; cin >> test; while(test--) { int n, m; cin >> n >> m; int ans = 1e9; while(n--) { static int x, y; cin >> x >> y; int t = (m - 1) / x; int tmp = (t + 1) * y; ans = min(ans, tmp); } cout << ans << '\n'; } return 0; }