#pragma comment(linker, "/stack:200000000") #include using namespace std; typedef long long ll; typedef pair pii; #define Rep(i,a,b) for(register int i=(a);i<=int(b);++i) #define Dep(i,a,b) for(register int i=(a);i>=int(b);--i) #define rep(i,a,b) for(register int i=(a);i=10)write(x/10);putchar(x%10+'0');} void wri(ll x){write(x);pc(' ');} void writeln(ll x){write(x);pc('\n');} const int mod = 998244353; const int maxn = 1e7+233; int w[1005][1005]; void solve(){ int n = read(),m = read(); int ans = 0x3f3f3f3f; Rep(i,1,n){ int x = read(),y = read(); ans = min(ans,((m-1)/x+1)*y); }writeln(ans); } int main(){ int T = read(); while(T--){ solve(); } }