#include using namespace std; namespace jumpmelon { typedef long long big; const int B = 1000000, PB = 1000000, P = 1000000007, INV_2 = (P + 1) >> 1; bool IsPrime[B + 1]; int pc, Prime[B + 1], Mu[B + 1], Sum[B + 1], Pre[PB + 1]; void init() { memset(IsPrime, 1, sizeof(IsPrime)); Mu[1] = 1; for (int i = 2; i <= B; i++) { if (IsPrime[i]) { Prime[pc++] = i; Mu[i] = P - 1; } for (int j = 0; j < pc; j++) { int t = i * Prime[j]; if (t > B) break; IsPrime[t] = 0; if (i % Prime[j]) Mu[t] = (P - Mu[i]) % P; else { Mu[t] = 0; break; } } } for (int i = 1; i <= B; i++) Sum[i] = int((Sum[i - 1] + (big)Mu[i] * i) % P); for (int a = 1; a <= PB; a++) for (int b = 1; a * b <= PB; b++) Pre[a * b] = (Pre[a * b] + a) % P; for (int i = 2; i <= PB; i++) Pre[i] = (Pre[i - 1] + Pre[i]) % P; } big msqrt(big x) { big t = (big)sqrt(x); while ((t + 1) * (t + 1) <= x) t++; while (t * t > x) t--; return t; } inline int sum(big x) { return int(x * (x + 1) / 2 % P); } int calc(big n) { if (n <= PB) return Pre[n]; int ans = 0; for (big l = 1, r; l <= n; l = r + 1) { r = n / (n / l); ans = int((ans + big(r - l + 1) * sum(n / l % P)) % P); } return ans; } void work() { init(); int kase; scanf("%d", &kase); while (kase--) { big n; int ans = 0; scanf("%lld", &n); for (big l = 1, r; l * l <= n; l = r + 1) { big t = n / (l * l); r = msqrt(n / t); ans = int((ans + big(Sum[r] + P - Sum[l - 1]) * calc(t)) % P); } printf("%d\n", ans); } } } int main() { jumpmelon::work(); return 0; }