N = int(input(N))
for _ in range(N):
    x = float(input(N))
    cur = int(x*10000)
    print(cur)<<
# include <bits/stdc++.h>

//  # define endl '\n';
using namespace std

int N

vector < int > denoms
signed main() {
    ios: : sync_with_stdio(0)
    cin.tie(0)
    cin >> N
    for (int i=0
         i < N
         i++) {
        long double t
        cin >> t

        int cur = 10000 * t
        cout << 10000 / __gcd(cur, 10000) << endl
    }
}
