// Problem: A. Odd Set
// Contest: Codeforces - Codeforces Round #729 (Div. 2)
// URL: https://codeforces.com/contest/1542/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
#define IL inline
#define x first
#define y second
typedef long long ll;
using namespace std;
#define int long long
int prime[100010];
int cnt;
bool check(int x)
{
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
		return 0;
		return 1;
}
const int mod=1e9+7;
int mx[100];
signed main()
{
	for(int i=2;i<=1000;i++)
		if(check(i))
		prime[cnt++]=i;
	int t;
	cin>>t;
	while(t--)
	{
		memset(mx,0,sizeof mx);
		int n;
		cin >> n;
		int res=0;
		int f=1;
		int nn=n;
		for(int i=2;i<=1000;i++)
		{
//			int x=prime[i];
			int x=i;		
			int xx=i;
			int cnt=0;
			for(int j=2;j<=i;j++)
			{
				cnt=0;
				if(xx%j==0)
				{
					while(xx%j==0)	xx/=j,cnt++;
					mx[j]=max(mx[j],cnt);
				}
			}
			int f=1;
			for(int j=2;j<=i;j++)
				f=f*(int)pow(j,mx[j]);
			res=(res+(n-nn/f)%mod*i%mod)%mod;
			n=nn/f;
			if(!n)
			break;
		//	cout<<res<<" "<<n<<endl;
		}
		cout<<res<<endl;
	}
    return 0;
}




