#include #define clr(x) memset(x,0,sizeof(x)) #define clrmax(x) memset(x,0x3f3f3f3f,sizeof(x)) #define clrmin(x) memset(x,-0x3f3f3f3f,sizeof(x)) #define pb push_back #define LL long long #define mod 1000000007 #define mp make_pair using namespace std; typedef pair pii; const int N = 1e2+10; const int M = 1e6+10; int T,n,m,k,s; int x[N],y[N]; int main(){ scanf("%d",&T); while(T--){ scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf("%d%d",x+i,y+i); int minx = 0x3f3f3f3f,nx; for(int i=1;i<=n;i++){ nx = ((m - 1) / x[i] + 1) * y[i]; if(nx < minx){ minx = nx; } } printf("%d\n",minx); } return 0; }