#include using namespace std; typedef long long ll; int tes,n,m,a[105],b[105],f[10105],ans; int read(){ int res=0,op=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-')op=-1;ch=getchar();} while(isdigit(ch))res=res*10+ch-'0',ch=getchar(); return res*op; } void write(int x){ if(x<0)putchar('-'),x=-x; if(x>9)write(x/10); putchar(x%10+48); } void solve(){ n=read(),m=read(); for(int i=1;i<=n;i++)a[i]=read(),b[i]=read(); ans=1e9; for(int i=1;i<=n;i++)ans=min(ans,((m-1)/a[i]+1)*b[i]); printf("%d\n",ans); } int main() { tes=read(); while(tes--)solve(); return 0; }