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