#include #include #include int KASE, x[110], y[110]; int f[2000010]; int Min(int x, int y) { return x > y ? y : x; } int Max(int x, int y) { return x > y ? x : y; } const int Inf = 0x3f3f3f3f; int main() { std::cin >> KASE; for (int Kase = 1; Kase <= KASE; Kase++) { int n, m; std::cin >> n >> m; for (int i = 1; i <= n; i++) std::cin >> x[i] >> y[i]; int Ans = Inf; for (int i = 1; i <= n; i++) { if (m % x[i] == 0) Ans = Min(Ans, (m / x[i]) * y[i]); else Ans = Min(Ans, (m / x[i] + 1) * y[i]); } std::cout << Ans << std::endl; } return 0; }