#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int mult(int a, int b)
{
return 1LL * a * b % mod;
}
int binpow(int a, int n)
{
int ans = 1;
while (n)
{
if (n & 1) ans = mult(ans, a);
a = mult(a, a);
n /= 2;
}
return ans;
}
int inverse(int x)
{
return binpow(x, mod - 2);
}
const int N = 10'000'000 + 1;
int main()
{
vector<int> primes;
vector<bool> pr(N, 1);
for (int i = 2; i < N; i++)
{
if (pr[i])
{
primes.push_back(i);
for (int j = 2 * i; j < N; j += i)
{
pr[j] = 0;
}
}
}
vector<pair<int, int>> p_to_b;
for (auto& p : primes)
{
long long x = p;
int b = 1;
while (x < N)
{
p_to_b.push_back({x, b});
b++;
x *= p;
}
}
sort(p_to_b.begin(), p_to_b.end());
int q;
cin >> q;
vector<pair<int, int>> queries(q);
for(int i = 0; i < q; i++)
{
cin >> queries[i].first;
queries[i].second = i;
}
vector<int> ans(q);
sort(queries.begin(), queries.end());
int j = 0;
int res = 1;
for(int i = 0; i < q; i++)
{
int k = queries[i].first;
while (j < (int)p_to_b.size() && p_to_b[j].first <= k)
{
int b = p_to_b[j].second;
res = mult(res, inverse(b));
res = mult(res, b + 1);
j++;
}
ans[queries[i].second] = (res + mod - k) % mod;
}
for(int i = 0; i < q; i++)
{
cout << ans[i] << ' ';
}
return 0;
}