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