#include #ifdef LOCAL #include "./debug.cpp" #else #define debug(...) #define print_line #endif using namespace std; using ll = long long; int main() { int T; cin >> T; while (T--) { ll N, fi, se; scanf("%lld %lld.%lld", &N, &fi, &se); debug(N, fi, se); if (se == 0) { cout << N << endl; continue; } if (1000 % se > 1) { cout << 0 << endl; continue; } ll sh = 1000 / se; cout << N / sh << endl; } }