/* * =template=.cpp * Copyright (C) 2017 hzw * * Distributed under terms of the MIT license. */ #include #include #include #include #include #include #include #include #include #include #include #define FR first #define SC second #define MP make_pair #define rep(i,a,b) for (int i=a;i<=b;i++) #define pb push_back #define ws wss using namespace std; typedef long long LL; typedef pair PII; template void upmax(T &a,T b) { if (a void upmin(T &a,T b) { if (a>b) a=b;} void read(int &x) { char ch;int fu=1; while ((ch=getchar())<=32); x=0; if (ch=='-') fu=-1;else x=ch-48; while ((ch=getchar())>32) x=x*10+ch-48; x*=fu; } const double pi=acos(-1); void upmax(int &a,int b) { if (ab) a=b;} //----------------------- const int N=500010; int n,cas, m; int main() { scanf("%d", &cas); for (int ii=1;ii<=cas;ii++) { scanf("%d%d", &n, &m); int ans=1<<30; for (int i=1;i<=n;i++) { int x, y; scanf("%d%d", &x, &y); ans = min(ans, ((m-1)/x+1)*y); } printf("%d\n", ans); } return 0; }