#include inline int read(){ int x=0,w=1; char ch=0; while (ch<'0' || ch>'9'){ ch=getchar(); if (ch=='-') w=-1; } while (ch<='9' && ch>='0'){ x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); } return x*w; } using namespace std; typedef long long ll; const int N=1e5+5; int main(){ int T=read(); while (T--){ int n=read(),m=read(),ans=1e9; for (int i=1;i<=n;++i){ int x=read(),y=read(); ans=min(ans,(m/x+(m%x!=0))*y); } printf("%d\n",ans); } return 0; }