#include using namespace std; typedef long long ll; const int N=4e6+5,Mod=1000000007; ll n; bool p[N]; int m,pri[N],mu[N],tot,ans; inline int add(int x, int y) { return (x+y>=Mod?x+y-Mod:x+y); } inline int sub(int x, int y) { return (x-y<0?x-y+Mod:x-y); } #define mul(x,y) (1ll*(x)*(y)%Mod) int main() { scanf("%*d"); while(~scanf("%lld",&n)) { m=sqrt(n); mu[1]=1; tot=0; for(int i=2;i<=m;++i) { if(!p[i]) pri[++tot]=i,mu[i]=-1; for(int j=1;j<=tot&&1ll*i*pri[j]<=m;++j) { p[i*pri[j]]=true; if(i%pri[j]==0) break; mu[i*pri[j]]=-mu[i]; } } ans=0; for(int i=1;i<=m;++i) if(mu[i]) { ll x=n/i/i; int sum=0; for(ll i=1,j;i<=x;i=j+1) { j=x/(x/i); sum=add(sum,(__int128)(x/i)*(j+i)*(j-i+1)%Mod); } ans=(mu[i]==1?add(ans,mul(sum,i)):sub(ans,mul(sum,i))); } printf("%d\n",mul(ans,Mod+1>>1)); } }