#include using namespace std; #define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i) #define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i) templateinline bool chkmin(T &x,T y){return (yinline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;} typedef long long ll; inline int read(){ static int x,f;f=1; static char c; while((c=getchar())!='-' && (c>'9' || c<'0')); if(c=='-') f=-1,c=getchar(); x=(c^'0'); while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0'); return x*f; } int main(){ int T=read(); while(T--){ int n=read(),m=read(); int Min=1e9; REP(i,1,n){ int x=read(),y=read(); chkmin(Min,((m-1)/x+1)*y); } printf("%d\n",Min); } return 0; }