#include using namespace std; const int N = 4010; const int M = 100100; #define inf 0x3f3f3f3f typedef long long ll; ll f[M]; int _; int main() { for (scanf("%d", &_); _; _ --) { int n, m; scanf("%d%d", &n, &m); int u, v; int ans = inf; for (int i = 1; i <= n; i ++) { scanf("%d%d", &u, &v); ans = min(ans, (m + u - 1) / u * v); } cout << ans << '\n'; } }