#include using namespace std; const int MAXN = (int) 1e5 + 7; const int INF = (int) 1e9 + 9; // counts maximal K that (y^k) is divisible by x int f(int x, int y) { int res = 0; while (x % y == 0) { ++res; x /= y; } return res; } int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int a, t; scanf("%d", &a); int add = 0; int deg5 = f(a, 5), deg2 = f(a, 2); // find powers of primes 5 and 2 because 10 = 5 * 2 // so one 10 is 5*2 so left fives are (deg5 - deg2) // we divide them by two because we can multiply by 4 every time if (deg5 > deg2) add = (deg5 - deg2 + 1) / 2; long long ans = a; while (add--) ans *= 4LL; printf("%lld\n", ans); } return 0; }