#include using namespace std; int main() { int T; scanf("%d", &T); while (T--) { int n, m; scanf("%d%d", &n, &m); int ans = 0x3f3f3f3f; for (int i = 1; i <= n; i++) { int x, y; scanf("%d%d", &x, &y); ans = min(ans, y * ((m + x - 1) / x)); } printf("%d\n", ans); } return 0; }