#include #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ld = long double; const ll mod = 998244353; #define fi first #define se second #define rep(i,n) for(ll i=0;i> T; while(T--){ ll N; cin >> N; ld S; cin >> S; ll ans=0; if(N>=1000) ans+=N-1000; for(ld i=1;i<=min(N,(ll)1000);i++){ ld x1=S*i; ld x2=(S+0.001)*i; ll x3=x1; ll x4=x2; if(x1==x3||x3!=x4) ans++; } cout << ans << endl; } return 0; }