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