#include constexpr int P = 1000000007, N = 1e6; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int mu[N + 1] = {}; mu[1] = 1; for (int i = 1; i <= N; ++i) for (int j = i + i; j <= N; j += i) mu[j] -= mu[i]; int t; std::cin >> t; while (t--) { int64_t n; std::cin >> n; int64_t ans = 0; for (int64_t d = 1; d * d <= n; ++d) { if (!mu[d]) continue; int res = 0; int64_t m = n / (d * d); for (int64_t l = 1, r; l <= m; l = r + 1) { r = m / (m / l); res = (res + (r - l + 1) % P * ((l + r) % P) % P * ((m / l) % P)) % P; } res = 1ll * res * (P + 1) / 2 % P * (P + mu[d]) % P * d % P; ans += res; } std::cout << ans % P << "\n"; } return 0; }