#include #include using namespace std; int n , m; int x[1200] , y[1200]; int ans; void work () { int i , t; scanf ( "%d%d" , &n , &m ); for ( i = 1 ; i <= n ; i++ ) { scanf ( "%d%d" , &x[i] , &y[i] ); t = (m-1) / x[i] + 1; if ( i == 1 ) ans = t * y[i]; else ans = min ( ans , t * y[i] ); } printf ( "%d\n" , ans ); } int main () { int t; scanf ( "%d" , &t ); while ( t-- ) work (); return 0; }