mod = 998244353
def binpow (a, n):
res = 1
while n > 0:
if n % 2 == 1:
res = res * a % mod
a = a * a % mod
n = n // 2
return res
def inverse (x):
return binpow(x, mod - 2)
N = 10**7 + 1
primes = []
pr = [1] * N
for i in range(2, N):
if pr[i] == 1:
primes.append(i)
for j in range(i * i, N, i):
pr[j] = 0
p_to_b = []
for p in primes:
pb = p
b = 1
while (pb < N):
p_to_b.append((pb, b))
b += 1
pb *= p
p_to_b = sorted(p_to_b)
q = int(input())
ks = list(map(int, input().split()))
queries = sorted([(ks[i], i) for i in range(q)])
ans = [0] * q
j = 0
res = 1
for i in range(q):
(k, ind) = queries[i]
while j < len(p_to_b):
(pb, b) = p_to_b[j]
if pb > k:
break
res = res * inverse(b) % mod
res = res * (b + 1) % mod
j += 1
ans[ind] = (res + mod - k) % mod;
print(" ".join(str(x) for x in ans))