#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair PII; typedef vector VI; #define fi first #define se second #define MP make_pair int read() { int v = 0, f = 1; char c = getchar(); while (c < 48 || 57 < c) {if (c == '-') f = -1; c = getchar();} while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar(); return v * f; } const int INF = 1e9; int main() { int cas = read(); while (cas--) { int n = read(), m = read(); int ans = INF; for (int i = 1; i <= n; i++) { int x = read(), y = read(); int t = m / x; if (m % x > 0) t++; ans = min(ans, t * y); } printf("%d\n", ans); } }