MOD = 10 ** 9 + 7 modinv = lambda a, mod=10 ** 9 + 7: pow(a, mod - 2, mod) fac = [1] * (10 ** 6 + 1) fac_inv = [1] * (10 ** 6 + 1) for i in range(1, 10 ** 6 + 1): fac[i] = (fac[i - 1] * i) % MOD fac_inv[i] = modinv(fac[i]) C = lambda n, k: (fac[n] * fac_inv[k] * fac_inv[n - k]) % MOD if n >= k else 0 P = lambda n, k: (fac[n] * fac_inv[n - k]) % MOD if n >= k else 0 H = lambda n, k: C(n + k - 1, k) T = int(input()) for _ in range(T): print(eval(input()))