Let $f(i)$ denote the minimum positive integer $x$ such that $x$ is not a divisor of $i$.

Compute $\sum_{i=1}^n f(i)$ modulo $10^9+7$. In other words, compute $f(1)+f(2)+\dots+f(n)$ modulo $10^9+7$.


-----Input-----

The first line contains a single integer $t$ ($1\leq t\leq 10^4$), the number of test cases. Then $t$ cases follow.

The only line of each test case contains a single integer $n$ ($1\leq n\leq 10^{16}$).


-----Output-----

For each test case, output a single integer $ans$, where $ans=\sum_{i=1}^n f(i)$ modulo $10^9+7$.


-----Examples-----

Input
6
1
2
3
4
10
10000000000000000
Output
2
5
7
10
26
366580019


-----Note-----

In the fourth test case $n=4$, so $ans=f(1)+f(2)+f(3)+f(4)$.

$1$ is a divisor of $1$ but $2$ isn't, so $2$ is the minimum positive integer that isn't a divisor of $1$. Thus, $f(1)=2$.

$1$ and $2$ are divisors of $2$ but $3$ isn't, so $3$ is the minimum positive integer that isn't a divisor of $2$. Thus, $f(2)=3$.

$1$ is a divisor of $3$ but $2$ isn't, so $2$ is the minimum positive integer that isn't a divisor of $3$. Thus, $f(3)=2$.

$1$ and $2$ are divisors of $4$ but $3$ isn't, so $3$ is the minimum positive integer that isn't a divisor of $4$. Thus, $f(4)=3$.

Therefore, $ans=f(1)+f(2)+f(3)+f(4)=2+3+2+3=10$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Number theory

Mathematics


Solutions:
import math
inp = int(input())
for _ in range(inp):
	n = input()
	n = int(n)
	lcm = 1
	mod = 10 ** 9 + 7
	count = n
	i = 1
	res = 0
	for i in range(1, 50):
		lcm = lcm * i // math.gcd(lcm, i)
		res = res % mod + (count - n // lcm) * i
		res %= mod
		count = n // lcm
		if count == 0:
			break
	print(res)


import math
from sys import stdin, stdout
MOD = 10 ** 9 + 7
dp = [1, 1, 2, 6, 12, 60, 60, 420, 840, 2520, 2520, 27720, 27720, 360360, 360360, 360360, 720720, 12252240, 12252240, 232792560, 232792560, 232792560, 232792560, 5354228880, 5354228880, 26771144400, 26771144400, 80313433200, 80313433200, 2329089562800, 2329089562800, 72201776446800, 144403552893600, 144403552893600, 144403552893600, 144403552893600, 144403552893600, 5342931457063200, 5342931457063200, 5342931457063200, 5342931457063200, 219060189739591200]

def solve():
	t = int(input())
	while t:
		t -= 1
		n = int(input())
		(x, a, b) = (0, 0, 0)
		for i in range(41, 0, -1):
			a = n // dp[i]
			x += (a - b) * (i + 1)
			x %= MOD
			b = a
		print(x)
solve()


from sys import stdin, stdout
ip = lambda : stdin.readline().rstrip('\r\n')
ips = lambda : ip().split()
out = lambda x, end='\n': stdout.write(str(x) + end)
mod = 10 ** 9 + 7
from math import gcd
for _ in range(int(ip())):
	n = int(ip())
	ans = 0
	lcm = 1
	r = n
	for i in range(2, n + 2):
		lcm = lcm // gcd(lcm, i) * i
		ans += (r - n // lcm) * i % mod
		r = n // lcm
		if r <= 0:
			break
	out(ans % mod)


import sys
input = sys.stdin.buffer.readline
from math import gcd, log2, ceil
MAX_N = int(1e+16)
MAX_F = ceil(log2(MAX_N)) + 1
MOD = int(1000000000.0) + 7

def lcm(a, b):
	return a // gcd(a, b) * b

def solve():
	last_lcm = 1
	ans = 0
	for fi in range(2, MAX_F):
		cur_lcm = lcm(last_lcm, fi)
		include = N // last_lcm
		exclude = N // cur_lcm
		ans += fi * (include - exclude) % MOD
		if cur_lcm > N:
			break
		last_lcm = cur_lcm
	return ans % MOD
test_cases = int(input())
for test_case in range(test_cases):
	N = int(input())
	print(solve())


def solve():
	mod = 10 ** 9 + 7
	n = int(input())
	perm = 1
	ans = n
	import math
	for i in range(1, 100):
		perm2 = perm * i // math.gcd(perm, i)
		ans += n // perm2
		perm = perm2
		ans = ans % mod
	print(ans)
t = int(input())
for _ in range(t):
	solve()


import math
import sys
from math import gcd
input = sys.stdin.readline

def solve():
	n = int(input())
	m = 10 ** 9 + 7
	even = n // 2
	odd = n - even
	ans = 2 * odd % m
	curr = even
	lcm = 2
	for i in range(3, 50):
		lcm = lcm * i // math.gcd(lcm, i)
		ans += i * (curr - n // lcm)
		ans %= m
		curr = n // lcm
	return ans % m
for _ in range(int(input())):
	print(solve())


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from math import gcd
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
MOD = 10 ** 9 + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	for _ in range(int(input())):
		n = int(input())
		i = 2
		x = 2
		y = n
		ans = 0
		while y > 0:
			x = x // gcd(x, i) * i
			p = n // x
			ans += (y - p) * i
			y = p
			i += 1
			ans %= MOD
		print(ans % MOD)
main()


def is_norm(i, k):
	for j in range(1, i + 1):
		if k % j != 0:
			return False
	return True

def main():
	a = []
	for i in range(1, 50):
		h = 1
		for j in range(1, i + 1):
			h *= j
		for k in range(2, 50 + 1):
			while h % k == 0:
				if not is_norm(i, h // k):
					break
				h //= k
		a.append(h)
	m = 49
	for _ in range(int(input())):
		n = int(input())
		ans = [0] * m
		x = 0
		for i in range(m):
			ans[i] = n // a[i]
			x += a[i] <= n
		for i in range(x):
			ans[i] -= ans[i + 1]
		su = 0
		for i in range(m):
			su += ans[i] * (i + 2)
		print(su % 1000000007)
main()


data = [0, 2, 5, 7, 10, 12, 16, 18, 21, 23, 26, 28]
from math import gcd

def lcm(x, y):
	return x * y // gcd(x, y)
for _ in range(int(input())):
	n = int(input())
	a = n // 12
	b = n % 12
	k = 12
	q = 5
	cnt = 0
	while True:
		k = lcm(k, q)
		if k > n:
			break
		cnt += n // k
		q += 1
	print((33 * a + data[b] + cnt) % 1000000007)


from math import gcd
mob = 10 ** 9 + 7
for i in range(int(input())):
	n = int(input())
	l = 1
	a = 0
	i = 2
	while 1:
		if l > n:
			break
		x = n // l
		l = l // gcd(l, i) * i
		y = n // l
		a = a + (x - y) * i
		i += 1
	print(a % mob)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a // gcd(a, b) * b
t = int(input())
m = 10 ** 9 + 7
p = []
for i in range(3, 101):
	p.append(i)
while t:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		no = n // 2
		ne = n // 2
	else:
		no = n // 2 + 1
		ne = n // 2
	s = no % m * 2 % m
	n1 = n
	k = 2
	s1 = ne % m * 3 % m
	i = 0
	k1 = lcm(p[i], 2)
	while k1 <= n:
		k = k1
		s1 += n // k % m
		s1 = s1 % m
		i += 1
		k1 = lcm(p[i], k)
	print((s + s1) % m)


from functools import lru_cache

@lru_cache(None)
def gcd(x, y):
	if x < y:
		return gcd(y, x)
	if y == 0:
		return x
	return gcd(y, x % y)

def main():
	p = 10 ** 9 + 7
	t = int(input())
	for _ in range(t):
		n = int(input())
		res = n % p
		i = 1
		cur = 1
		while cur <= n:
			res += n // cur
			res %= p
			i += 1
			cur = cur * i // gcd(cur, i)
		print(res)
main()


import math
for _ in range(int(input())):
	n = int(input())
	mod = 1000000007
	ans = 0
	curr = n
	x = 1
	y = 1
	while curr > 0:
		x += 1
		gcd = math.gcd(x, y)
		y *= x // gcd
		divisibles = n // y
		notdivisibles = curr - divisibles
		ans += x * notdivisibles % mod
		ans %= mod
		curr = divisibles
	print(ans)


import math
from sys import stdin

def A():
	t = int(stdin.readline())
	while t:
		t -= 1
		n = int(stdin.readline())
		a = [int(x) for x in stdin.readline().split()]
		b = []
		c = []
		for i in a:
			if i % 2:
				b.append(i)
			else:
				c.append(i)
		if len(b) == len(c):
			print('Yes')
		else:
			print('No')

def B():
	t = int(stdin.readline())
	while t:
		t -= 1
		d = [int(x) for x in stdin.readline().split()]
		(n, a, b) = (d[0], d[1], d[2])
		if a == 1:
			if (n - 1) % b == 0:
				print('YES')
			else:
				print('NO')
		else:
			k = 1
			sav = False
			while k <= n:
				if k % b == n % b:
					sav = True
					break
				k *= a
			if sav:
				print('YES')
			else:
				print('NO')

def lcm(a, b):
	return int(a * b / math.gcd(a, b))

def C():
	t = int(stdin.readline())
	while t:
		t -= 1
		n = int(stdin.readline())
		res = 0
		g = 1
		for i in range(1, n + 1):
			g = lcm(g, i)
			if g > n:
				break
			res += n // g
		print((res + n) % (10 ** 9 + 7))
C()


import bisect
from collections import *
from itertools import *
import math
import heapq
from pprint import pprint

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instring():
	s = input()
	return list(s[:len(s) - 1])

def invariable():
	return map(int, input().split())

def lcm(a, b):
	return a * b // math.gcd(a, b)

class Solution:

	def main(self, n):
		res = 0
		res += n * 2
		n = n | 0
		i = 2
		l = 1
		while l < n and i < 100:
			l = lcm(l, i)
			k = 1
			while l % (i + 1) == 0:
				i += 1
				k += 1
			res += n // l * k
			res = res % (10 ** 9 + 7)
			i += 1
		return res % (10 ** 9 + 7)
t = inp()
outputs = []
for _ in range(t):
	n = inp()
	output = Solution().main(n)
	outputs.append(output)
for o in outputs:
	print(o)


from sys import stdin
from math import gcd
input = stdin.readline
rn = lambda : int(input())
rns = lambda : map(int, input().split())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().strip()
YN = lambda x: print('YES') if x else print('NO')
mod = 10 ** 9 + 7

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(rn()):
	n = rn()
	ans = 0
	d = 1
	i = 1
	while True:
		d = lcm(d, i)
		if d > n:
			break
		ans += n // d
		i += 1
	ans = (ans + n) % mod
	print(ans)


import time

def main():
	modulo = 10 ** 9 + 7
	divs = (2, 6, 12, 60, 60, 420, 840, 2520, 2520, 27720, 27720, 360360, 360360, 360360, 720720, 12252240, 12252240, 232792560, 232792560, 232792560, 232792560, 5354228880, 5354228880, 26771144400, 26771144400, 80313433200, 80313433200, 2329089562800, 2329089562800, 72201776446800, 144403552893600, 144403552893600, 144403552893600, 144403552893600, 144403552893600, 5342931457063200, 5342931457063200, 5342931457063200, 5342931457063200)
	t = i_input()
	for tt in range(t):
		n = i_input()
		out = n * 2
		for div in divs:
			out += n // div
			if div > n:
				break
		print(out % modulo)

def i_input():
	return int(input())

def l_input():
	return input().split()

def li_input():
	return list(map(int, l_input()))

def il_input():
	return list(map(int, l_input()))
TT = time.time()
main()


from sys import stdin, setrecursionlimit, maxsize
from collections import deque
from math import gcd
input = stdin.readline
MOD = 10 ** 9 + 7

def lcm(x, y):
	return x // gcd(x, y) * y
for _ in range(int(input())):
	n = int(input())
	g = 1
	res = 0
	for i in range(1, n + 1):
		g = lcm(g, i)
		if g > n:
			break
		res += n // g
	print((res + n) % MOD)


import sys
t = int(sys.stdin.readline())

def gcm(a, b):
	(a, b) = (max(a, b), min(a, b))
	while b != 0:
		x = b
		b = a % b
		a = x
	return a

def lcm(a, b):
	return a * b // gcm(a, b)
for _ in range(t):
	n = int(sys.stdin.readline())
	x = 2
	ans = 1
	answer = 2 * n
	while ans <= n:
		ans = lcm(ans, x)
		answer += n // ans % (10 ** 9 + 7)
		x += 1
	print(answer % (10 ** 9 + 7))


import math
for _ in range(int(input())):
	n = int(input())
	s = 1
	i = 2
	ans = n
	while s <= n:
		ans += n // s
		s = i * s // math.gcd(i, s)
		i += 1
	print(ans % (10 ** 9 + 7))


from math import gcd
MOD = int(1000000000.0 + 7)

def lcm(a, b):
	return a * b // gcd(a, b)
nums = [i for i in range(54)]
f = [None for i in range(54)]
f[1] = 1
for i in range(2, 54):
	f[i] = lcm(f[i - 1], i)
t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	for i in range(2, 54):
		c = n // f[i - 1] - n // f[i]
		x = i * c % MOD
		ans = (ans + x) % MOD
	print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return list(map(int, input().split()))

def II():
	return int(input())

def LS():
	return list(input().split())

def S():
	return input()
from math import gcd

def main():
	t = II()
	nums = list(range(2, 100))
	for _ in range(t):
		n = II()
		ans = 0
		tmp = 1
		left_num = n + 0
		for p in nums:
			g = gcd(tmp, p)
			if g == p:
				continue
			tmp *= p // g
			go_next = n // tmp
			ans += p * (left_num - go_next) % mod
			ans %= mod
			left_num = go_next + 0
			if left_num == 0:
				break
		print(ans)
	return 0
main()


s = [2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41]
q = [2, 3, 2, 5, 7, 2, 3, 11, 13, 2, 17, 19, 23, 5, 3, 29, 31, 2, 37, 41]
u = [1, 2, 6, 12, 60, 420, 840, 2520, 27720, 360360, 720720, 12252240, 232792560, 5354228880, 26771144400, 80313433200, 2329089562800, 72201776446800, 144403552893600, 5342931457063200]
t = int(input())
for j in range(t):
	n = int(input())
	v = [n // u[i] - n // (u[i] * q[i]) for i in range(20)]
	z = [v[i] * s[i] for i in range(20)]
	print(sum(z) % (10 ** 9 + 7))


import sys

def gcd(a, b):
	c = max(a, b)
	d = min(a, b)
	a = c
	b = d
	while b > 0:
		(a, b) = (b, a % b)
	return a
input = sys.stdin.readline
t = int(input())
a = []
c = [2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41]
b = 1
for i in range(19):
	if b % c[i] != 0:
		x = b * c[i] // gcd(b, c[i])
		b = x
		a.append(b)
for _ in range(t):
	n = int(input())
	b = [n]
	d = 0
	an = 0
	for i in range(19):
		b.append(n // a[i])
	for i in range(19, -1, -1):
		an += (b[i] - d) * c[i]
		an %= 1000000007
		d = b[i] % 1000000007
	print(an)


from math import *
for s in [*open(0)][1:]:
	i = j = 1
	a = n = int(s)
	while i <= n:
		j += 1
		a += n // i
		i = j * i // gcd(i, j)
	print(a % (10 ** 9 + 7))


import math
mod = int(1000000000.0 + 7)
for _ in range(int(input())):
	n = int(input())
	c = n
	ans = 0
	(j, i) = (1, 1)
	while 1:
		j = j * i // math.gcd(j, i)
		ans = (ans % mod + (c - n // j % mod) * (i % mod) % mod) % mod
		c = n // j
		i += 1
		if c == 0:
			break
	print(ans)


def compute_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def binary_search(list1, n):
	low = 0
	high = len(list1) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if list1[mid] < n:
			low = mid + 1
		elif list1[mid] > n:
			high = mid - 1
		else:
			return mid
	return -1

def compute_lcm(x, y):
	lcm = x * y // compute_gcd(x, y)
	return lcm
t = int(input())
while t > 0:
	n = int(input())
	list1 = [1, 2, 3, 5, 1, 7, 0, 3, 5]
	(final, k, z, ans) = (n, 1, 2, 0)
	while final > 0:
		z1 = compute_lcm(k, z)
		c = n // k - n // z1
		ans += z * c
		z += 1
		m = binary_search(list1, z)
		k = z1
		ans %= 1000000007
		final -= c
	print(ans)
	t -= 1


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
li = [1]
n = 2
while li[-1] < 10 ** 16:
	li.append(li[-1] * n // gcd(li[-1], n))
	n += 1

def prob():
	n = int(input())
	mod = 10 ** 9 + 7
	ans = n
	for i in li:
		ans += n // i
		ans %= mod
	print(ans)
t = 1
t = int(input())
for _ in range(0, t):
	prob()


import math

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	answer = 0
	answer += 2 * (n // 2 + n % 2)
	answer += 3 * (n // 2)
	d = 2 * 3
	k = 4
	while d <= n:
		answer = (answer + n // d) % 1000000007
		d = lcm(d, k)
		k += 1
	print(answer)


import math
from fractions import gcd

def main():
	t = int(input())
	while t:
		mod = 1000000007
		n = int(input())
		cnt = 1
		ans = 0
		for i in range(2, 43):
			if cnt > n:
				break
			lcm = cnt * i // math.gcd(i, cnt)
			tot = n // cnt
			ex = n // lcm
			ans += (tot % mod - ex % mod) * i % mod
			ans %= mod
			cnt = lcm
		print(int(ans))
		t -= 1
main()


def find(prod):
	for i in range(3, prod):
		if prod % i != 0:
			return i

def newprev(nw):
	for i in range(2, nw + 1):
		if nw % i == 0:
			return i

def solve():
	mod = 10 ** 9 + 7
	n = int(input())
	even = n // 2
	total = even * 3
	odd = n - even
	total += odd * 2
	prod = 6
	prev = 3
	while True:
		ct = n // prod
		nw = find(prod)
		total = total - ct * prev
		total = total + ct * nw
		c = newprev(nw)
		prod = c * prod
		prev = nw
		if prod > n:
			break
	print(total % mod)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
from math import gcd

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 10 ** 9 + 7
for _ in range(t):
	n = int(input())
	ans = 2 * n % mod
	m = 1
	for i in range(2, 41):
		m = lcm(m, i)
		ans += n // m
		ans %= mod
	print(ans)


from math import gcd

def g(xs):
	o = 1
	for x in xs:
		o = o * x // gcd(o, x)
	return o
gg = [g(range(1, x + 1)) for x in range(1, 100)]
p = 10 ** 9 + 7

def h(x):
	o = x
	for d in gg:
		if d > x:
			break
		o += x // d
		o %= p
	return o
for _ in range(int(input())):
	print(h(int(input())))


import sys
import math
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	total = n
	mul = 2
	cnt = 2
	answer = 0
	if n == 1:
		print(2)
	else:
		while total > 0:
			temp = total - n // mul
			if temp < 0:
				break
			answer = (answer + cnt * temp) % (7 + 10 ** 9)
			total = n // mul
			cnt += 1
			mul = mul * cnt // math.gcd(mul, cnt)
		print(answer)


t = int(input())
mod = 10 ** 9 + 7

def prime(a):
	for x in range(2, int(a ** 0.5) + 1):
		if a % x == 0:
			return x
	return a
res = []
for i in range(t):
	n = int(input())
	ans = 0
	(fact, k) = (1, 0)
	while fact <= n:
		while True:
			ans += n // fact
			k += 1
			if k == 2 or fact % k != 0:
				break
		if k >= 2:
			fact *= prime(k)
	res.append(ans % mod)
for r in res:
	print(r)


import math

def SumMinNonDivisor(n):
	Sum = 0
	remnos = n
	j = 2
	while remnos != 0:
		for i in range(2, j + 1):
			if j % i == 0:
				if math.log(j, i) % 1 == 0:
					Sum += (remnos * i - remnos + remnos % i) * (j // i)
					remnos = (remnos - remnos % i) // i
					break
				else:
					break
		j += 1
	return Sum

def AltSumNonDivisor(n):
	Sum = 0
	for i in range(1, n + 1):
		for j in range(1, i + 2):
			if i % j != 0:
				Sum += j
				break
	return Sum
t = int(input())
inp = []
for i in range(t):
	inpt = int(input())
	inp.append(inpt)
for k in inp:
	print(SumMinNonDivisor(k) % (10 ** 9 + 7))


mod = 10 ** 9 + 7
from math import gcd
t = int(input())
while t:
	t -= 1
	n = int(input())
	res = 0
	lcm = 1
	i = 2
	while i:
		if lcm > n:
			break
		L = n // lcm
		lcm = lcm // gcd(i, lcm) * i
		r = n // lcm
		val = (L - r) * i % mod
		res = (res + val) % mod
		i += 1
	print(res)


mod = 1000000000.0 + 7

def gcd(a, b):
	while b:
		c = b
		b = a % b
		a = c
	return a

def helper(n, val, y):
	if n == 0:
		return 0
	ct = 0
	z = val // gcd(val, y)
	x = n // z
	ct = (n - x) % mod * val % mod
	ct += helper(x, val + 1, y * z) % mod
	ct %= mod
	return ct
for _ in range(int(input())):
	n = int(input())
	print(round(helper(n, 2, 1)))


from sys import stdin
inp = stdin.readline
t = int(inp())
for _ in range(t):
	n = int(inp())
	i = 2
	plus = 2 * n
	x = 2
	while True:
		if x % i != 0:
			for j in range(2, i + 1):
				if i % j == 0:
					x *= j
					break
		if x <= n:
			plus += n // x
		else:
			break
		plus = plus % (10 ** 9 + 7)
		i += 1
	print(plus % (10 ** 9 + 7))


import math
n = int(input())
b = []
for i in range(n):
	b.append(int(input()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def sana(x):
	i = 2
	d = 1
	b = 0
	y = x
	if x == 1:
		return 2
	elif x == 2:
		return 5
	else:
		while y != 0:
			if d % i != 0:
				d = lcm(d, i)
				a = x // d
				b = b + (y - a) * i
				y = a
			i += 1
	if len(str(b)) >= 10:
		b = b % (10 ** 9 + 7)
	return b
for i in b:
	print(sana(i))


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a // gcd(a, b) * b
t = int(input())
for i in range(t):
	mod = 1000000007
	n = int(input())
	sm = 0
	if n % 2 == 0:
		sm += n // 2 * 2 % mod
		sm = (sm + n // 2 * 3) % mod
		ex = 4
		s = 6
		df = 1
		while True:
			if s > n:
				break
			if ex >= 45:
				break
			if s % ex == 0:
				ex += 1
				df += 1
				continue
			x = n // s
			sm = (sm + x * df) % mod
			df = 0
			s = lcm(s, ex)
			ex += 1
			df += 1
		print(sm)
	else:
		sm += (n // 2 + 1) * 2 % mod
		n = n - 1
		sm = (sm + n // 2 * 3) % mod
		ex = 4
		s = 6
		df = 1
		while True:
			if s > n:
				break
			if ex >= 45:
				break
			if s % ex == 0:
				ex += 1
				df += 1
				continue
			x = n // s
			sm = (sm + x * df) % mod
			df = 0
			s = lcm(s, ex)
			ex += 1
			df += 1
		print(sm)


from sys import stdin
import math
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	s = 0
	c = 1
	ans = 2 * n
	for i in range(2, n + 1):
		c *= i // int(math.gcd(c, i))
		w = n // c
		ans += w
		if c > n:
			break
	print(ans % (10 ** 9 + 7))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
try:
	lcm_arr = [0, 1]
	i = 2
	while 1:
		lcm_arr.append(lcm(lcm_arr[i - 1], i))
		if lcm_arr[-1] > 10 ** 16:
			break
		i += 1
	x = i
	for _ in range(int(input())):
		n = int(input())
		res = 0
		for i in range(x, 0, -1):
			if i != x:
				res += (n // lcm_arr[i] - n // lcm_arr[i + 1]) * (i + 1)
			else:
				res += n // lcm_arr[i] * (i + 1)
		print(res % (10 ** 9 + 7))
except Exception as exc:
	print(exc)


import math
t = int(input())
m = 1000000007
while t:
	n = int(input())
	(i, y, res) = (2, 2, 2 * n % m)
	while y <= n:
		y = y * i // math.gcd(y, i)
		res = (res + n // y) % m
		i += 1
	print(res)
	t -= 1


MOD = int(1000000000.0) + 7
MAX_N = int(1e+16)

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
cLCM = [-1]
(idx, lcm) = (1, 1)
while lcm <= MAX_N:
	lcm = lcm * idx // gcd(lcm, idx)
	idx += 1
	cLCM.append(lcm)

def Res(n):
	return sum([(n // cLCM[i - 1] - n // cLCM[i]) * i for i in range(2, len(cLCM))]) % MOD
t = int(input())
for _ in range(t):
	print(Res(int(input())))


import math
MOD = 10 ** 9 + 7

def solve():
	n = int(input())
	count = n
	ans = 0
	d = 1
	x = 1
	while count:
		s = x // math.gcd(d, x)
		d *= s
		next_count = count // s
		ans += (count - next_count) * x
		ans %= MOD
		count = next_count
		x += 1
	print(ans)

def main():
	t = int(input())
	for __ in range(t):
		solve()
main()


import sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
mod = 1000000007
sys.setrecursionlimit(1000000)
try:
	sys.stdin = open('actext.txt', 'r')
	OPENFILE = 1
except:
	pass

def get_ints():
	return map(int, input().split())

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False

def solve(n):
	if n == 1:
		print(2)
		return
	ans = 0
	lcm = 1
	for i in range(2, 100):
		if lcm > n:
			break
		l = n // lcm
		lcm = lcm // math.gcd(lcm, i) * i
		r = n // lcm
		ans += (l - r) * i % mod
		ans = ans % mod
	print(ans)
t = int(input())
for tt in range(t):
	n = int(input())
	solve(n)


import os, sys
input = lambda : sys.stdin.buffer.readline().rstrip(b'\r\n')

def dbp(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
a_str = lambda : input().decode('ascii')
get_int_list = lambda : [int(x) for x in input().split()]
join_str = lambda l, ch=' ': ch.join((str(x) for x in l))
MOD = 10 ** 9 + 7
from math import gcd

def lcm(i, j):
	return i * j // gcd(i, j)
lcmpile = [1]
i = 2
while lcmpile[-1] < 10 ** 16:
	lcmpile.append(lcm(i, lcmpile[-1]))
	i += 1

def do_thing():
	n = int(input())
	ans = 0
	for li in lcmpile:
		if li > n:
			break
		ans += n // li
		ans %= MOD
	return (ans + n) % MOD

def multicase():
	maxcc = int(input().strip())
	for cc in range(maxcc):
		print(do_thing())
multicase()


IP = lambda : list(map(int, input().split()))
IP = lambda : list(map(int, input().split()))

def gcd(a, b):
	return gcd(b, a % b) if b else a

def lcm(a, b):
	return a * b // gcd(a, b)
mod = 10 ** 9 + 7
for i in range(int(input())):
	l = 1
	n = int(input())
	ret = 2 * n
	i = 2
	while True:
		l = lcm(l, i)
		if l > n:
			break
		ret += n // l % mod
		i += 1
	print(ret % mod)


import sys
import os
import math
from io import BytesIO, IOBase
from collections import defaultdict, Counter, deque
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = pow(10, 9) + 7
l = [0, 1]
lcm = 1
p = 1
while lcm <= 10 ** 16:
	p += 1
	gcd = math.gcd(lcm, p)
	lcm = lcm * p // gcd
	l.append(lcm)
t = int(input())
for i in range(t):
	n = int(input())
	end = 41
	ans = 0
	mi = 0
	while end > 0:
		cur = n // l[end] - mi
		ans = (ans + (end + 1) * cur) % mod
		mi += cur
		end -= 1
	print(ans)


import sys
import math
import random
import heapq
input = sys.stdin.readline

def pow(a, n, m):
	if n == 0:
		return 1
	x = pow(a, n // 2, m)
	if n % 2 == 0:
		return x * x % m
	else:
		return x * x * a % m

def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a

def bs(arr, le, ri):
	l = 0
	arr.sort()
	r = len(arr) - 1
	ans = 10000000
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= le and arr[m] <= ri:
			ans = arr[m]
			r = m - 1
		elif arr[m] < le:
			l = m + 1
		else:
			r = m - 1
	return ans
t = int(input())
while t > 0:
	n = int(input())
	ans = ((n // 2 + n % 2) * 2 % 1000000007 + n // 2 * 3 % 1000000007) % 1000000007
	lcm = 6
	p = 3
	l = [4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41]
	for i in l:
		x = n // lcm
		ans = (ans + (i - p) * x % 1000000007) % 1000000007
		p = i
		lcm = lcm * i // gcd(lcm, i)
	print(ans)
	t -= 1


import math
t = int(input())
for k in range(t):
	n = int(input())
	m = 1
	i = 2
	s = 0
	mode = 10 ** 9 + 7
	while n > 0:
		x = math.gcd(i, m)
		j = i // x
		s += (n - n // j) * i
		s = s % mode
		n = n // j
		m = m * j
		i += 1
	print(s)


import sys
import bisect
from bisect import bisect_left as lb
from bisect import bisect_right as rb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
mod1 = 998244353
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs2(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0
b = []
vis = []
tot = 0
time = []
time1 = []

def hnbhai(tc):
	n = sb()
	tot = 0
	tot += n // 2 * 3
	tot %= mod
	tot += (n + 1) // 2 * 2
	(x, y) = (2, 3)
	while x < n:
		temp = x * y // gcd(x, y)
		temp1 = n // temp
		tot = (tot - temp1 * y % mod + mod) % mod
		x = temp
		while x % (y + 1) == 0:
			y += 1
		tot = (tot + temp1 * (y + 1) % mod) % mod
		y += 1
	print(tot)

def dfs(root):
	global tot, vis, gp
	for child in gp[root]:
		if vis[child] == 0:
			tot += 1
			vis[child] = 1
			dfs(child)
for _ in range(sb()):
	hnbhai(_ + 1)


import sys, os
from io import BytesIO, IOBase
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(iinp()):
	n = iinp()
	ans = 2 * n % mod
	x = 2
	i = 3
	while x <= n:
		ans = (ans + n // x) % mod
		x = lcm(x, i)
		i += 1
	print(ans)


def intlist():
	return [int(i) for i in input().split(' ')]

def stringlist():
	return input().split(' ')

def yes(t):
	if t:
		return 'YES'
	return 'NO'

def printjoin(l, str=False):
	if str:
		l = [str(i) for i in l]
	return ' '.join(l)

def power_of_two(n):
	b = bin(n)[2:]
	return int(b) == 10 ** (len(b) - 1)

def bit_count(n):
	return bin(n).count('1')

def lcm(x, y):
	(a, b) = (x, y)
	while y:
		(x, y) = (y, x % y)
	return a * b // x

def solve():
	n = int(input())
	v = 1
	c = 1
	mod = 10 ** 9 + 7
	ans = n % mod
	while True:
		c = lcm(c, v)
		if c > n:
			break
		ans += n // c
		ans = ans % mod
		v += 1
	return int(ans)
t = input()
for tt in range(int(t)):
	print(solve())


import sys
from bisect import bisect_left as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
for _ in range(ii()):
	n = ii()
	ans = (n + 1) // 2 * 2 % mod
	ans += n // 2 * 3 % mod
	ans %= mod
	p = 2
	q = 3
	while p < n:
		x = p * q // gcd(p, q)
		y = n // x
		p = x
		ans = (ans + mod - y * q % mod) % mod
		while p % (q + 1) == 0:
			q += 1
		ans = (ans + y * (q + 1) % mod) % mod
		q += 1
	print(ans % mod)


import math
for _ in range(int(input())):
	n = int(input())
	ans = n * 2
	mod = 10 ** 9 + 7
	ans %= mod
	x = 1
	for i in range(2, 42):
		x = x * i // math.gcd(x, i)
		ans += n // x
		ans %= mod
	print(ans)


import bisect
import sys
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
from collections import defaultdict
MOD = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		n = int(input())
		cur_lcm = 1
		remain = n
		ans = 0
		for x in range(2, 50):
			cur_lcm = lcm(cur_lcm, x)
			divisible_ele = n // cur_lcm
			ans = (ans + (remain - divisible_ele) * x) % MOD
			remain = divisible_ele
		print(ans)
main()


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
m = int(1000000000.0 + 7)
for _ in range(int(input())):
	n = int(input())
	g = 1
	ans = 0
	for i in range(1, n + 1):
		g = lcm(g, i)
		if g > n:
			break
		ans += n // g
	print(int((ans + n) % m))


def f(n):
	for i in range(1, 10000):
		if n % i != 0:
			return i
import math
badguy = [[1, 2]]
for _ in range(30):
	(a, b) = badguy[-1]
	nxt = a * b // math.gcd(a, b)
	badguy.append([nxt, f(nxt)])
for _ in range(int(input())):
	n = int(input())
	ret = 2 * n
	pre = 2
	for (a, b) in badguy[1:]:
		m = n // a
		ret -= m * pre
		ret += m * b
		pre = b
	print(ret % int(1000000000.0 + 7))


from math import gcd

def main():
	n = int(input())
	for i in range(n):
		y = int(input())
		res = 0
		lcmm = 1
		j = 2
		stat = True
		while stat:
			if lcmm > y:
				stat = False
			else:
				L = y // lcmm
				lcmm = lcmm // gcd(j, lcmm) * j
				R = y // lcmm
				v = (L - R) * j % mod
				res = (res + v) % mod
			j += 1
		print(res)
mod = 1000000007
main()


import math

def lcm(i, j):
	return i * j // math.gcd(i, j)

def strangeFunction(n):
	if n == 1:
		return 2
	ans = 0
	l = 1
	for i in range(2, 42):
		val = n // l - n // lcm(i, l)
		ans += val * i % 1000000007
		ans = ans % 1000000007
		l = lcm(l, i)
	return ans
for _ in range(int(input())):
	n = int(input())
	print(strangeFunction(n))


import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
II = lambda : int(I())
IN = lambda x: map(int, x.split())
L = lambda x: list(IN(x))
M = 1000000007
P = print
T = True
F = False
l = [0]
fact = 1
LL = 10000000000000000
i = 1
while True:
	fact = fact * i // math.gcd(fact, i)
	l.append(fact)
	if fact > LL:
		break
	i += 1
ln = i

def find(n):
	if n == 1:
		return 2
	if n == 2:
		return 5
	s = n % M * 2 % M
	for i in range(2, ln + 1):
		if n < l[i]:
			break
		q = n // l[i] % M
		s = (s + q) % M
	return s
for _ in range(II()):
	n = II()
	P(find(n))


import io, os, sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def readint():
	return int(input().decode())

def lcm(x, y):
	(x, y) = [max(x, y), min(x, y)]
	if x % y == 0:
		return x
	m = lcm(y, x % y)
	return x * (m // (x % y))
lcms = [0 for _ in range(150)]
lcms[1] = 1
for i in range(2, 101):
	lcms[i] = lcm(lcms[i - 1], i)
for i in range(101, 150):
	lcms[i] = lcm(lcms[i - 1], i)
	if lcms[i] > int(1e+17):
		break
t = readint()
for _ in range(t):
	n = readint()
	if n == 1:
		sys.stdout.write('2\n')
		continue
	ans = 0
	i = 2
	while lcms[i - 1] <= n:
		ans += i * (n // lcms[i - 1] - n // lcms[i])
		i += 1
	sys.stdout.write('{}\n'.format(str(ans % int(1000000000.0 + 7))))


mod = 10 ** 9 + 7
import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	c = (n - n // 2) * 2
	g = [0] * 52
	f = [0] * 52
	lc = 1
	for i in range(1, 50):
		lc = lcm(i, lc)
		g[i] = n - n // lc
		f[i] = g[i] - g[i - 1]
	out = 0
	for i in range(2, 50):
		out = (out + i * f[i]) % mod
	print(out)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
mod = int(1000000000.0 + 7)
lcm = [0, 1]
i = 2
while i < 1000:
	g = gcd(i, lcm[-1])
	if lcm[-1] * i // g < 1e+18:
		lcm.append(lcm[-1] * i // g)
	else:
		break
	i += 1
t = int(input())
for it in range(t):
	n = int(input())
	ans = 0
	s = []
	for i in range(1, len(lcm)):
		s.append(n // lcm[i])
	for i in range(1, len(s)):
		ans += (s[i - 1] - s[i]) * (i + 1)
	print(ans % mod)


import math
inp = int(input())
for _ in range(inp):
	n = input()
	n = int(n)
	lcm = 1
	mod = 10 ** 9 + 7
	count = n
	i = 1
	res = 0
	while count != 0:
		lcm = lcm * i // math.gcd(lcm, i)
		res = res % mod + (count - n // lcm) * i
		res %= mod
		count = n // lcm
		i += 1
	print(res)


def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
li = [2, 6]
r = [3, 4]
n = 40
for i in range(4, n):
	pro = computeGCD(li[-1], i)
	if pro != i:
		k = li[-1] * i // pro
		li.append(k)
		l = i
		while k % l == 0:
			l = l + 1
		r.append(l)
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	k = (n + 1) // 2
	ans = 2 * k
	ans = ans + 3 * (n // 2)
	for i in range(1, len(li)):
		a = n // li[i]
		ans = (ans + a * r[i] - a * r[i - 1]) % mod
	print(ans)


t = int(input())
from math import gcd
u = [[2, 2]]
k = u[-1][0]
a = 3
while k < 10 ** 19:
	u.append([u[-1][0] * a // gcd(u[-1][0], a), a])
	if a == gcd(u[-2][0], a):
		u.pop()
	a += 1
	k = u[-1][0]
for i in range(t):
	n = int(input())
	ans = 0
	cnt = 0
	k = 0
	while True:
		a = cnt
		cnt = (u[k][0] - 1) * (n // u[k][0]) + n % u[k][0]
		if cnt == a:
			break
		ans += u[k][1] * ((u[k][0] - 1) * (n // u[k][0]) + n % u[k][0] - a)
		k += 1
	print(ans % 1000000007)


import sys
lcms = [6, 12, 60, 60, 420, 840, 2520, 2520, 27720, 27720, 360360, 360360, 360360, 720720, 12252240, 12252240, 232792560, 232792560, 232792560, 232792560, 5354228880, 5354228880, 26771144400, 26771144400, 80313433200, 80313433200, 2329089562800, 2329089562800, 72201776446800, 144403552893600, 144403552893600, 144403552893600, 144403552893600, 144403552893600, 5342931457063200, 5342931457063200, 5342931457063200, 5342931457063200, 219060189739591200]
MOD = 10 ** 9 + 7
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
t = inp[ii]
ii += 1
for _ in range(t):
	n = inp[ii]
	ii += 1
	ans = 0
	if n % 2 == 0:
		ans = 5 * (n // 2)
	else:
		ans = 5 * (n // 2) + 2
	for x in lcms:
		ans = (ans + n // x) % MOD
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	mod = 10 ** 9 + 7
	res = 2 * n % mod
	b1 = 2
	b2 = 3
	while n // b1 > 0:
		res += n // b1 % mod
		res %= mod
		b1 = b1 * b2 // math.gcd(b1, b2)
		b2 += 1
	res %= mod
	print(res)


from math import gcd
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	m = 1
	i = 2
	s = 0
	while n > 0:
		x = gcd(m, i)
		j = i // x
		s += (n - n // j) * i
		s = s % mod
		n //= j
		m *= j
		i += 1
	print(s)


from math import gcd
MOD = 10 ** 9 + 7

def solve(n):
	odd = (n + 1) // 2
	even = n // 2
	typ3 = even - even // 3
	typ4 = (even - 3) // 6 + 1
	ans = odd * 2
	ans = (ans + typ3 * 3) % MOD
	ans = (ans + typ4 * 4) % MOD
	M = 12
	add = 5
	cur = 5
	while M <= n:
		ans += add * (n // M)
		ans %= MOD
		x = cur // gcd(cur, M)
		M *= x
		cur += 1
		add = 1
		while M % cur == 0:
			cur += 1
			add += 1
	return ans
for case in range(int(input())):
	n = int(input())
	ans = solve(n)
	print(ans)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b
t = int(input())
modd = 1000000007
for hh in range(0, t):
	n = int(input())
	rem = n
	ans = 0
	if n == 1:
		print(2)
		continue
	rem = n // 2
	ans = (ans + (n - rem) * 2) % modd
	prvlcm = 2
	for i in range(3, 51):
		if rem == 0:
			break
		done = n - rem
		cntdiv = n // i
		prvlcm = int(lcm(prvlcm, i))
		rem = n // prvlcm
		ans = (ans + (n - done - rem) * i) % modd
	print(ans)


def solve(a, b, c):
	if a == 0:
		return 0
	cnt = 0
	val1 = b // math.gcd(b, c)
	val2 = a // val1
	cnt = (a - val2) % mod * b % mod
	cnt += solve(val2, b + 1, c * val1) % mod
	cnt %= mod
	return cnt
import sys, io, os, math
try:
	yash = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
except:
	yash = lambda : sys.stdin.readline().encode()
I = lambda : [*map(int, yash().split())]
for t in range(I()[0]):
	(n,) = I()
	mod = int(1000000000.0) + 7
	print(solve(n, 2, 1))


import sys
input = sys.stdin.readline
from math import gcd
mod = 10 ** 9 + 7
A = [1]
for i in range(2, 50):
	A.append(A[-1] * i // gcd(A[-1], i))
A = A[1:]
t = int(input())
for tests in range(t):
	n = int(input())
	ANS = 2 * n
	for a in A:
		ANS += n // a
		ANS %= mod
	print(ANS)


import random
import math
from collections import defaultdict
import itertools
from sys import stdin, stdout
import sys
import operator

def main():
	mod = 10 ** 9 + 7
	lcms = [(0, 0), (1, 2), (2, 3), (6, 4), (12, 5), (60, 7), (420, 8), (840, 9), (2520, 11), (27720, 13), (360360, 16), (720720, 17), (12252240, 19), (232792560, 23), (5354228880, 25), (26771144400, 27), (80313433200, 29), (2329089562800, 31), (72201776446800, 32), (144403552893600, 37), (5342931457063200, 41)]
	t = int(input())
	for _ in range(t):
		n = int(input())
		ans = 0
		i = 1
		while i < 21 and lcms[i][0] <= n:
			ans = (ans + n // lcms[i][0] * (lcms[i][1] - lcms[i - 1][1])) % mod
			i += 1
		print(ans)
main()


import math
import heapq
import sys
input = sys.stdin.readline
S = lambda : input()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
H = 1000000007
lc = 1
l = []
t = 10000000000000000
i = 1
while lc <= t:
	lc = lc * i // math.gcd(lc, i)
	l.append(lc)
	i += 1
for _ in range(I()):
	n = I()
	s = n % H * 2 % H
	for i in range(1, len(l)):
		if l[i] > n:
			break
		q = n // l[i] % H
		s = (s + q) % H
	print(s)


import math
test = int(input())
for cs in range(test):
	n = int(input())
	mod = 10 ** 9 + 7
	cc = 1
	v = 2
	ans = n
	while 1:
		cc = cc * v // math.gcd(cc, v)
		if cc > n:
			break
		ans += n // cc
		ans %= mod
		v += 1
	print((ans + n) % mod)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def get_p(n):
	x = 1
	for i in range(2, n + 1):
		x = i * x // gcd(i, x)
	return x
xp = [2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41]
p = [1]
for x in xp:
	p.append(get_p(x))
for i in range(len(xp) - 1, 0, -1):
	xp[i] -= xp[i - 1]
ans = []
q = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	cur = 0
	for i in range(len(xp)):
		cur += n // p[i] * xp[i]
	ans.append(cur % q)
print('\n'.join(map(str, ans)))


import math
mod = 10 ** 9 + 7
for nt in range(int(input())):
	n = int(input())
	left = n
	num = 1
	lcm = [1]
	hcf = 1
	for i in range(2, 50):
		hcf = math.gcd(lcm[-1], i)
		lcm.append(lcm[-1] * i // hcf)
	done = 0
	ans = 0
	i = len(lcm) - 1
	while i >= 0 and left != 0:
		num = lcm[i]
		c = n // num
		ans += (c - done) * (i + 2)
		done = c
		ans = ans % mod
		i -= 1
	print(ans)


import math
answers = []
store = {}

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def solve(n):
	i = 2
	prevLcm = 1
	lcm = 1
	final = 0
	while i <= n + 1:
		lhs = gcd(i - 1, prevLcm)
		lhsLCM = prevLcm * (i - 1) // lhs
		rhs = gcd(i, lcm)
		rhsLCM = lcm * i // rhs
		current = i * math.floor(n // lhsLCM - n // rhsLCM)
		if lhsLCM > n:
			break
		lcm = rhsLCM
		prevLcm = lhsLCM
		final += current
		final = final % (10 ** 9 + 7)
		i += 1
	answers.append(final % (10 ** 9 + 7))
T = int(input())
while T:
	n = int(input())
	solve(n)
	T -= 1
for ans in answers:
	print(ans)


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = inp()
	ans = 0
	cur = 1
	for i in range(2, 42):
		lcm = cur * i // gcd(cur, i)
		temp = n // cur
		temp -= n // lcm
		temp %= mod
		ans += temp * i
		ans %= mod
		cur = lcm
	pr(ans)
for _ in range(inp()):
	solve()


import itertools
import math
import sys

def lcm(a, b):
	return a * b // math.gcd(a, b)

def prefix_sum_of_f(n):
	result = 0
	curr_multiplier = 1
	how_many_remain = n
	curr_divisor = 2
	while how_many_remain > 0:
		next_multiplier = lcm(curr_multiplier, curr_divisor)
		k = next_multiplier // curr_multiplier
		how_many_will_remain = how_many_remain // k
		how_many_to_drop = how_many_remain - how_many_will_remain
		result += how_many_to_drop * curr_divisor
		how_many_remain = how_many_will_remain
		curr_multiplier = next_multiplier
		while curr_multiplier % curr_divisor == 0:
			curr_divisor += 1
	return result

def read_ints():
	return map(int, sys.stdin.readline().split())

def main():
	mod = 10 ** 9 + 7
	[t_n] = read_ints()
	for i_t in range(t_n):
		[n] = read_ints()
		result = prefix_sum_of_f(n) % mod
		print(result)
main()


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
mod = 10 ** 9 + 7

def solve(n):
	prev = 1
	ans = 0
	i = 2
	while True:
		num1 = n // prev
		larger_lcm = lcm(prev, i)
		prev = larger_lcm
		num2 = n // larger_lcm
		if num1 == 0 and num2 == 0:
			return ans % mod
		temp = num1 - num2
		ans += i * temp
		i += 1
t = int(input())
while t:
	n = int(input())
	ans = solve(n)
	print(ans)
	t -= 1


from functools import reduce
from fractions import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def f(n):
	mod = 1000000000 + 7
	result = 0
	left_numbers = n
	prev_step = 1
	y = 1
	while left_numbers > 0:
		y += 1
		step = lcm(prev_step, y)
		new_left_numbers = left_numbers // (step // prev_step)
		result += (left_numbers - new_left_numbers) * y % mod
		left_numbers = new_left_numbers
		prev_step = step
	return result % mod
n_t = int(input())
for t in range(n_t):
	n = int(input())
	result = f(n)
	print(result)


import math
import re
import string
import sys
from itertools import permutations
from collections import Counter
import itertools
MOD = 1000000007

def inp():
	return map(int, input().split(' '))

def ninp():
	return int(input())
for _ in range(ninp()):
	n = ninp()
	i = 1
	j = 2
	res = n
	while i <= n:
		res += n // i
		i = j * i // math.gcd(i, j)
		j += 1
	print(res % MOD)


from sys import stdin

def mcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	ans = a // mcd(a, b) * b
	return ans

def main():
	mod = 10 ** 9 + 7
	cases = int(stdin.readline())
	while cases > 0:
		n = int(stdin.readline())
		(ans, curr, prev) = (0, 2, 1)
		while prev <= n:
			vals = n // prev
			f = lcm(curr, prev)
			b = n // f
			ans = (ans + curr * (vals - b)) % mod
			(prev, curr) = (f, curr + 1)
		ans %= mod
		print(ans)
		cases -= 1
main()


import sys
import os.path
from collections import *
import math
import bisect
import heapq as hq
from fractions import Fraction
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def lcm(x, y):
	return x * y // math.gcd(x, y)
arr = [2]
n = 1
i = 2
h = Counter()
h[1] = 2
p = 10 ** 16 + 7
mod = 10 ** 9 + 7
arr = [1]
while n <= p:
	x = lcm(n, i)
	h[x] = (h[n] * (x // n) + 1) % mod
	i += 1
	n = x
	arr.append(x)
arr.sort()
t = int(input())
while t:
	res = 0
	t -= 1
	n = int(input())
	while n > 0:
		x = 1
		for i in range(len(arr)):
			if arr[i] > n:
				break
			x = arr[i]
		i = n // x
		res = (res + i * h[x] % mod) % mod
		n -= i * x
	print(res)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
for _ in range(t):
	i = 1
	gc = 1
	num = int(input())
	ans = num
	while gc <= num:
		x = gcd(gc, i)
		if x == 1:
			gc = gc * i
		elif gc % i != 0:
			gc = gc * i // x
		ans = ans + num // gc
		i = i + 1
	print(ans % 1000000007)


MOD = 10 ** 9 + 7

def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // computeGCD(x, y)

def func():
	lcm = 1
	ans = 0
	for i in range(1, 50):
		lcm = LCM(lcm, i)
		ans += n // lcm
	print((ans + n) % MOD)
for _ in range(int(input())):
	n = int(input())
	func()


from math import gcd

def get_not_divisor(prev, n):
	for x in range(int(prev) + 1, n // 2 + 5):
		if n % x:
			return x

def get_smallest_divisor(n):
	i = 2
	while i * i <= n:
		if not n % i:
			return i
		i += 1
	return n

def solve(n):
	result = 0
	result += 2 * ((n + 1) // 2)
	result += 3 * (n // 2 - n // 6)
	temp = 6
	divisor = 3
	while n // temp:
		divisor = get_not_divisor(divisor, temp)
		result += divisor * (n // temp)
		temp = temp * divisor // gcd(temp, divisor)
		result -= divisor * (n // temp)
		result %= 1000000007
	print(result % (1000000000 + 7))
for _ in range(int(input())):
	solve(int(input()))


from math import gcd

def solve(n):
	res = n * 2
	(i, x) = (3, 2)
	while x <= n:
		res += n // x
		x = x * i // gcd(x, i)
		i += 1
	return res % 1000000007
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


import itertools
import math
MOD = 10 ** 9 + 7
lcms = [1]
for i in itertools.count(2):
	lcm = lcms[-1] * i // math.gcd(lcms[-1], i)
	lcms.append(lcm)
	if lcms[-1] >= 10 ** 16:
		break
n_testcase = int(input())
for testcase in range(n_testcase):
	n = int(input())
	answer = 0
	iterator = zip(list(enumerate(lcms, start=1))[-2::-1], list(enumerate(lcms, start=1))[-1::-1])
	for ((i, lcm), (i2, lcm2)) in iterator:
		count = n // lcm
		count_prev = n // lcm2
		answer = (answer + (i + 1) * (count - count_prev)) % MOD
	print(answer)


import math
for t in range(int(input())):
	n = int(input())
	mod = 10 ** 9 + 7

	def func(n, val, y):
		if n == 0:
			return 0
		ct = 0
		z = val // math.gcd(val, y)
		x = n // z
		ct = (n - x) % mod * val % mod
		ct += func(x, val + 1, y * z) % mod
		ct = ct % mod
		return ct
	print(func(n, 2, 1))


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	res = 2 * n
	a = 2
	b = 3
	while a <= n:
		res += n // a
		res %= 1000000007
		a = a * b // math.gcd(a, b)
		b += 1
	print(res)


import sys

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a // gcd(a, b) * b

def f(n):
	ans = 0
	fv = n
	var = 2
	c = 2
	while n >= var:
		ans = ans + (fv - n // var) * c
		ans = ans % 1000000007
		fv = n // var
		c = c + 1
		var = lcm(var, c)
	ans = ans + fv * c
	ans = ans % 1000000007
	return ans
t = int(input())
i = 0
while i != t:
	i = i + 1
	n = int(input())
	print(f(n))


from math import *
from typing import Counter

def vinp():
	return map(int, input().split())

def linp():
	return list(map(int, input().split()))

def ninp():
	return int(input())

def inp():
	return int(input())

def comp1(a, b, c):
	return (a // b - a // comp2(b, c)) * c

def comp2(b, c):
	return b * c // gcd(b, c)

def mod(f):
	return f % 1000000007
for _ in range(ninp()):
	a = ninp()
	b = 1
	c = 1
	f = 0
	while a >= b:
		c += 1
		f += comp1(a, b, c)
		b = comp2(b, c)
	print(mod(f))


def gcd(a, b):
	if a < 0:
		return gcd(-a, b)
	if b < 0:
		return gcd(a, -b)
	if a > b:
		return gcd(b, a)
	if a == 0:
		return b
	return gcd(b % a, a)
mod = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	g = 1
	answer = n % mod
	j = 1
	while g <= n:
		j += 1
		answer = (answer + n // g) % mod
		g = g * j // gcd(g, j)
	print(answer)


t = int(input())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
mod = 10 ** 9 + 7
for _ in range(t):
	n = int(input())
	i = 1
	G = 1
	ans = 0
	while i <= n and G <= n:
		G = G * i // gcd(G, i)
		if G > n:
			break
		ans += n // G
		i += 1
	print((ans + n) % mod)


import sys
from math import gcd
input = sys.stdin.readline

def stup(n):
	r = 0
	for i in range(1, n + 1):
		for j in range(2, i ** 2 + 10):
			if i % j != 0:
				r += j
				break
	return r

def smart(n):
	l = 1
	k = 2
	r = 0
	MOD = int(1000000000.0 + 7)
	while n > 0:
		nl = l * k // gcd(l, k)
		m = n // (nl // l)
		r += (n - m) * k % MOD
		l = nl
		n = m
		k += 1
	return r % MOD

def solve():
	n = int(input())
	print(smart(n))
for i in range(int(input())):
	solve()


p = 10 ** 9 + 7
li = [2, 3, 2, 5, 7, 2, 3, 11, 13, 2, 17, 19, 23, 5, 3, 29, 31, 2, 37, 41]
import math
prod = 1
for i in li:
	prod *= i
z = prod
for _ in range(int(input())):
	prod = z
	n = int(input())
	dp = [0] * (len(li) + 1)
	ans = 0
	val = 0
	for i in range(len(li) - 1, -1, -1):
		if i != 0:
			prod //= li[i]
			dp[i] = n // prod
			dp[i] -= val
			val += dp[i]
		else:
			dp[i] = (n + 1) // prod
		if i == 2:
			ans += 4 * dp[i] % p
		elif i == 5:
			ans += 8 * dp[i] % p
		elif i == 6:
			ans += 9 * dp[i] % p
		elif i == 9:
			ans += 16 * dp[i] % p
		elif i == 13:
			ans += 25 * dp[i] % p
		elif i == 14:
			ans += 27 * dp[i] % p
		elif i == 17:
			ans += 32 * dp[i] % p
		else:
			ans += li[i] * dp[i] % p
	print(int(ans % p))


from math import gcd
mod = 10 ** 9 + 7
T = int(input())
for test_case in range(T):
	n = int(input())
	cur_lcm = 1
	x = 2
	ans = 0
	while cur_lcm <= n:
		new_lcm = cur_lcm * x // gcd(cur_lcm, x)
		cur_lcm_multiple_cnt = n // cur_lcm
		new_lcm_multiple_cnt = n // new_lcm
		ans += (cur_lcm_multiple_cnt - new_lcm_multiple_cnt) * x % mod
		if ans >= mod:
			ans -= mod
		cur_lcm = new_lcm
		x += 1
	print(ans)


from collections import deque
import heapq
from math import sqrt
import operator
from operator import itemgetter
import sys
import copy
inf_var = 0
if inf_var == 1:
	inf = open('input.txt', 'r')
else:
	inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_one_float():
	return float(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def read_str():
	return input().rstrip()

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a // gcd(a, b) * b

def main():
	tests = read_one_int()
	mod = 10 ** 9 + 7
	for _ in range(tests):
		n = read_one_int()
		res = 0
		l = 1
		for d in range(2, 42):
			a = n // l
			l = lcm(l, d)
			b = n // l
			res += (a - b) * d
			res %= mod
		print(res)
main()


def gcd(a, b):
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)
MOD = 1000000000 + 7
t = int(input())
lcm = [0] * 42
lcm[1] = 1
lcm[2] = 2
lcm[3] = 6
for i in range(4, 42):
	lcm[i] = lcm[i - 1] * i // gcd(max(lcm[i - 1], i), min(lcm[i - 1], i))
term = [0] * 42
term[2] = 1
for i in range(3, 42):
	term[i] = gcd(max(lcm[i - 1], i), min(lcm[i - 1], i))
for _ in range(t):
	ans1 = 0
	x = int(input())
	temp = 0
	temp1 = 0
	for i in range(2, 42):
		temp = x // lcm[i - 1]
		temp1 = i // term[i]
		ans1 = ans1 + (temp - temp // temp1) % MOD * i % MOD
		ans1 = ans1 % MOD
	print(ans1)


for _ in range(int(input())):
	n = int(input())

	def gcd(a, b):
		if b == 0:
			return a
		return gcd(b, a % b)

	def lcm(a, b):
		return a * b // gcd(a, b)
	ans = 0
	g = 1
	i = 1
	while g <= n:
		g = lcm(g, i)
		if g > n:
			break
		ans += n // g
		i += 1
	print((ans + n) % 1000000007)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
T = int(input())
MOD = 10 ** 9 + 7
while T:
	T -= 1
	n = int(input())
	fact = [[2, 2], [3, 3], [2, 4], [5, 5], [7, 7], [2, 8], [3, 9], [11, 11], [13, 13], [2, 16], [17, 17], [19, 19], [23, 23], [5, 25], [3, 27], [29, 29], [31, 31], [2, 32], [37, 37], [41, 41]]
	ans = 0
	for i in fact:
		(div, el) = i
		divisible = n // div
		gone = n - divisible
		ans += gone * el % MOD
		ans %= MOD
		n = divisible
		if not n:
			break
	print(ans)


MOD = 1000000007
k = int(input())

def gcd(x, y):
	return gcd(y, x % y) if y > 0 else x

def lcm(x, y):
	return x // gcd(x, y) * y
for _ in range(k):
	(g, res) = (1, 0)
	i = 1
	n = int(input())
	while g <= n:
		g = lcm(g, i)
		if g > n:
			break
		res += n // g
		i += 1
	print(int((res + n) % MOD))


import os, sys
from io import BytesIO, IOBase
from math import log2, ceil, sqrt, gcd
from _collections import deque
import heapq as hp
from bisect import bisect_left, bisect_right
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7
ck = [[2, 2], [3, 3], [2, 4], [5, 5], [7, 7], [2, 8], [3, 9], [11, 11], [13, 13], [2, 16], [17, 17], [19, 19], [23, 23], [5, 25], [3, 27], [29, 29], [31, 31], [2, 32], [37, 37], [41, 41], [43, 43], [47, 47], [49, 49]]
for _ in range(int(input())):
	n = int(input())
	z = n
	ans = 0
	x = 1
	j = 0
	while x <= n:
		x *= ck[j][0]
		t = n // x
		if z - t < 0:
			break
		ans += (z - t) * ck[j][1]
		z = t
		j += 1
		ans %= mod
	print(ans)


from math import gcd
from functools import reduce, lru_cache

@lru_cache(1000)
def lcm(n):
	return reduce(lambda a, b: a * b // gcd(a, b), list(range(1, n + 1)), 1)

def solve(n):
	ans = n
	for i in range(1, 101):
		ans += n // lcm(i)
		ans %= 1000000007
	print(ans)
t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	solve(n)


from math import gcd
MOD = 10 ** 9 + 7

def f(n, m):
	return n // m * (m - 1) + n % m

def solve():
	n = int(input())
	ans = (n + 1) // 2 * 2
	(k, p) = (3, 2)
	while n >= p:
		g = gcd(k, p)
		ans = (ans + f(n // p, k // g) * k) % MOD
		p *= k // g
		k += 1
	return ans
import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for i in range(t):
	print(solve())


import math
for _ in range(int(input())):
	n = int(input())
	s = 0
	x = 2
	m = 1
	g = 0
	prev = 1
	MOD = 1000000000.0 + 7
	left = n
	N = n
	for i in range(1, 1000000000):
		if left <= 0:
			break
		m = prev * i
		g = math.gcd(prev, i)
		prev = m // g
		s = s + (i * ((left - N // prev + MOD) % MOD) + MOD) % MOD
		left = N // prev
	print(int(s % MOD))


from math import gcd
t = int(input())
mod = pow(10, 9) + 7
for _ in range(t):
	n = int(input())
	ans = (n - n // 2) * 2
	l = 2
	for i in range(3, 50):
		temp = 0
		temp += n // l
		l = l * i // gcd(l, i)
		temp -= n // l
		ans = (ans + temp * i) % mod
	print(ans)


import sys
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
input = sys.stdin.readline
t = int(input())
mod = 10 ** 9 + 7
f = [0] * 45
f[1] = 1
for i in range(2, 45):
	f[i] = lcm(f[i - 1], i)
for _ in range(t):
	n = int(input())
	ans = 0
	for i in range(2, 45):
		r = n // f[i - 1] - n // f[i]
		ans = (ans + r * i % mod) % mod
	print(ans)


import math
T = int(input())
for x in range(0, T):
	n = int(input())
	sum = 0
	lcm = 1
	i = 2
	while True:
		if lcm > n:
			break
		l = n // lcm
		lcm = lcm // math.gcd(i, lcm) * i
		r = n // lcm
		values = (l - r) * i % (1000000000 + 7)
		sum = (sum + values) % (1000000000 + 7)
		i += 1
	print(sum)


import math
n = int(input())

def solve(k):
	i = 2
	kq = 0
	mod = 10 ** 9 + 7
	lcm = 1
	while lcm <= k:
		l = k // lcm
		lcm = lcm * i // math.gcd(lcm, i)
		r = k // lcm
		kq += (l - r) * i
		i += 1
	return kq % mod
ls = []
for i in range(n):
	ls.append(int(input()))
for i in ls:
	print(solve(i))


p = 10 ** 9 + 7

def gcd(a, b):
	if a > b:
		(a, b) = (b, a)
	if b % a == 0:
		return a
	return gcd(b % a, a)
L_list = [1]
L = 1
for i in range(2, 100):
	g = gcd(i, L)
	L = L * i // g
	L_list.append(L)
	if L > 10 ** 16:
		break

def process(n):
	answer = 0
	for i in range(len(L_list) - 1):
		a = L_list[i]
		b = L_list[i + 1]
		answer += (i + 2) * (n // a - n // b)
		answer = answer % p
	return answer
t = int(input())
for i in range(t):
	n = int(input())
	print(process(n))


import sys
modul = 10 ** 9 + 7
my_dict = {3: 6}
val = 6
i = 3

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
while val < 10 ** 16:
	i += 1
	val = i * val // gcd(i, val)
	my_dict[i] = val
maradek = [2, 3, 2, 3, 2]

def solve(N):
	rnd = N // 6
	mar = N % 6
	res = rnd * 15 % modul
	res += sum(maradek[:mar])
	for mk in my_dict.keys():
		rnd = N // my_dict[mk]
		res += rnd
		res %= modul
	print(res)

def run():
	out = ''
	T = int(input())
	for i in range(T):
		N = int(input())
		solve(N)
run()


import math
for m in range(int(input())):
	n = int(input())
	res = 2 * n
	f = 1
	i = 2
	while True:
		f = int(f * i // int(math.gcd(f, i)))
		if f > n:
			break
		res = (res + n // f) % 1000000007
		i = i + 1
	print(res)


import math
mod = 10 ** 9 + 7
for times in range(int(input())):
	n = int(input())
	f = 1
	res = 0
	i = 1
	while f <= n:
		tf = f
		f = f * i // int(math.gcd(f, i))
		res = (res + i * (n // tf - n // f)) % mod
		i += 1
	print(res)


import math
t = int(input())
m = 1000000007
while t:
	n = int(input())
	(i, y, res) = (2, 2, 2 * n % m)
	while True:
		y = y * i // math.gcd(y, i)
		if y > n:
			break
		res = (res + n // y) % m
		i += 1
	print(res)
	t -= 1


from bisect import *
import math
from collections import *
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
test = int(input())
for cs in range(test):
	n = int(input())
	mod = 10 ** 9 + 7
	cc = 1
	v = 2
	ans = n
	while 1:
		cc = cc * v // math.gcd(cc, v)
		if cc > n:
			break
		ans += n // cc
		ans %= mod
		v += 1
	print((ans + n) % mod)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
mod = 1000000007
t = int(input())
while t:
	t -= 1
	n = int(input())
	o = n // 2 + n % 2
	e = n // 2
	sod = o * 2
	sev = 3 * e
	num = 3
	p = 2
	while p <= n:
		p = p // gcd(p, num) * num
		x = n // p
		sev += x
		num += 1
	ans = sod % mod + sev % mod
	print(ans % mod)


import math
m = 1000000007
t = int(input())
for test in range(t):
	n = int(input())
	i = 2
	lcmi = 2
	lcmim = 1
	s = 0
	while lcmim <= n:
		s = (s + (n // lcmim - n // lcmi) * i) % m
		lcmim = lcmi
		i += 1
		lcmi = lcmi * i // math.gcd(i, lcmi)
	else:
		print(s)


import sys
import math
T = int(input())
MOD = int(1000000000.0 + 7)

def f(n):
	for i in range(2, n + 2):
		if n % i != 0:
			return i

def get_lcm(a, b):
	return a * b // math.gcd(a, b)

def simple_solution(n):
	summa = 0
	for i in range(1, n + 1):
		summa += f(i)
	return summa

def fast_solution(n):
	summa = n
	lcm = 1
	for i in range(1, n + 1):
		lcm = get_lcm(lcm, i)
		if lcm > n:
			break
		inc = n // lcm
		summa += inc
	return summa % MOD
for _ in range(T):
	n = int(input())
	print(fast_solution(n))


import sys, math
sys.setrecursionlimit(10 ** 7)
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(a, b):
	if a == 0:
		return b
	return a // math.gcd(a, b) * b
for _ in range(int(input())):
	n = int(input())
	g = 1
	ans = 0
	for i in range(1, n + 1):
		g = lcm(g, i)
		if g > n:
			break
		ans += n // g
	print((ans + n) % mod)


from collections import Counter
import string
import math
import bisect
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def lcm(a, b):
	return a * b // math.gcd(a, b)
testcases = vary(1)
for _ in range(testcases):
	n = vary(1)
	ans = n
	k = 1
	for i in range(1, 102):
		k = lcm(k, i)
		if k > n:
			break
		ans += n // k
	print(ans % (10 ** 9 + 7))


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
PI = 3.141592653589793
INF = float('inf')
MOD = 1000000007

def bin32(num):
	return '{0:032b}'.format(num)

def add(x, y):
	return (x + y) % MOD

def sub(x, y):
	return (x - y + MOD) % MOD

def mul(x, y):
	return x * y % MOD

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)

def power(x, y):
	res = 1
	x %= MOD
	while y != 0:
		if y & 1:
			res = mul(res, x)
		y >>= 1
		x = mul(x, x)
	return res

def mod_inv(n):
	return power(n, MOD - 2)

def prob(p, q):
	return mul(p, power(q, MOD - 2))

def ii():
	return int(input())

def li():
	return [int(i) for i in input().split()]

def ls():
	return [i for i in input().split()]
store = [INF, 1]
l = 2
ind = 2
for i in range(100):
	l = lcm(l, ind)
	store.append(l)
	ind += 1
for t in range(ii()):
	t += 1
	ans = 0
	n = ii()
	for i in range(2, 102):
		x = n // store[i - 1] - n // store[i]
		ans = (ans + i * x) % MOD
	print(ans)


import math

def solve(n):
	i = 1
	j = 2
	res = n
	ans = 0
	while i <= n:
		x = int(i / math.gcd(i, j) * j)
		ans += (res - n // x) * j
		res = n // x
		i = x
		j += 1
	if n == 1:
		return 2
	if n == 2:
		return 5
	return ans % 1000000007
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


from math import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(3 * 10 ** 5)

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
p = 10 ** 9 + 7
while t:
	t -= 1
	n = inp()
	r = (n + 1) // 2
	r = r * 2
	r = r % p
	ha = 2
	po = 3
	while ha <= n:
		q1 = n // ha
		ha1 = po * ha // gcd(po, ha)
		q2 = n // ha1
		diff = q1 - q2
		ex = diff * po
		po += 1
		ha = ha1
		r += ex
		r %= p
	print(r)


mod = 10 ** 9 + 7
for i in range(int(input())):
	n = int(input())
	ans = 2 * n % mod
	ans += n // 2
	ans = ans % mod
	ans += n // 6
	ans = ans % mod
	ans += n // 12
	ans = ans % mod
	ans += n // 60 * 2
	ans = ans % mod
	ans += n // 420
	ans = ans % mod
	ans += n // 840
	ans = ans % mod
	ans += n // 2520 * 2
	ans = ans % mod
	ans += n // 27720 * 2
	ans = ans % mod
	ans += n // 360360 * 3
	ans = ans % mod
	ans += n // 720720
	ans = ans % mod
	ans += n // (720720 * 17) * 2
	ans = ans % mod
	ans += n // (720720 * 17 * 19) * 4
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23) * 2
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23 * 5) * 2
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23 * 5 * 3) * 2
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23 * 5 * 3 * 29) * 2
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23 * 5 * 3 * 29 * 31)
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23 * 5 * 3 * 29 * 31 * 2) * 5
	ans = ans % mod
	ans += n // (720720 * 17 * 19 * 23 * 5 * 3 * 29 * 31 * 2 * 37) * 4
	ans = ans % mod
	print(ans)


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
MOD = 1000000007

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def sout(v):
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def sieve(n):
	primes = []
	least_prime_divs = [0] * (n + 1)
	for i in range(2, n + 1):
		if not least_prime_divs[i]:
			least_prime_divs[i] = i
			primes.append(i)
		for p in primes:
			if i * p > n or p > least_prime_divs[i]:
				break
			least_prime_divs[i * p] = p
	return primes
t = ii()
while t:
	t -= 1
	n = ii()
	if n % 2 == 0:
		ans = n // 2 * 2
	else:
		ans = (n // 2 + 1) * 2
	if n % 6 == 0:
		ans += n // 6 * 6
	elif n % 6 == 1:
		ans += n // 6 * 6
	elif n % 6 > 1 and n % 6 < 4:
		ans += n // 6 * 6 + 3
	elif n % 6 >= 4:
		ans += (n // 6 + 1) * 6
	m = 6
	prev = n // 6
	for i in range(4, 42):
		m = m * i // gcd(m, i)
		ans += (prev - n // m) * i
		prev = n // m
		if m > n:
			break
	print(ans % MOD)


from math import gcd

def f(a, b):
	return a * b // gcd(a, b)
t = int(input())
mod = int(1000000000.0 + 7)
for _ in range(t):
	n = int(input())
	res = (n // 2 + n % 2) * 2
	i = 3
	mul = 2
	while mul <= n:
		nx = f(mul, i)
		x = (n // mul - n // nx) * i
		res = (res + x) % mod
		mul = nx
		i = i + 1
	print(res)


def gcd(a, b):
	while b % a != 0:
		(a, b) = (b % a, a)
	return a

def LCM(x, y):
	(x, y) = (min(x, y), max(x, y))
	return x * y // gcd(x, y)

def ans(n):
	k = 10 ** 9 + 7
	(G, a) = (1, 0)
	i = 1
	for i in range(1, n + 1):
		G = LCM(G, i)
		if G > n:
			break
		a += n // G
	return (a + n) % k
m = int(input())
for i in range(m):
	n = int(input())
	print(ans(n))


t = int(input())
primes = [True] * 100
pp = []
for i in range(2, 100):
	if primes[i]:
		pp.append(i)
		for j in range(i * i, 100, i):
			primes[j] = False
temp = pp.copy()
for i in temp:
	k = i
	while k < 100:
		k = k * i
		pp.append(k)
pp.sort()
m = 10 ** 9 + 7
for _ in range(t):
	left = int(input())
	ans = 0
	for p in pp:
		if primes[p]:
			safe = left // p
			ans += p * (left - safe) % m
			left = safe
		else:
			for pr in pp:
				if p % pr == 0:
					save = pr
					break
			safe = left // save
			ans += p * (left - safe) % m
			left = safe
		if left == 0:
			break
	print(ans % m)


import math
mod = pow(10, 9) + 7
for _ in range(int(input())):
	n = int(input())
	res = 0
	a = [i for i in range(2, 44)]
	l = [1]
	for i in range(42):
		l.append(l[-1] * a[i] // math.gcd(l[-1], a[i]))
	for i in range(41):
		x = n // l[i]
		xx = n // l[i + 1]
		ans = (x - xx) % mod * a[i] % mod
		res = (res + ans) % mod
	print(res)


t = int(input())
mod = 10 ** 9 + 7
for i in range(t):
	n = int(input())
	a = 0
	x = n
	l = [2, 3, 2, 5, 7, 2, 3, 11, 13, 2, 17, 19, 23, 5, 3, 29, 31, 2, 37, 41]
	p = [1, 1, 2, 1, 1, 3, 2, 1, 1, 4, 1, 1, 1, 2, 3, 1, 1, 5, 1, 1]
	for j in range(len(l)):
		ox = x
		x //= l[j]
		a += (ox - x) * l[j] ** p[j]
	print(a % mod)


from math import gcd
t = int(input())
x = 1
dp = [1 for _ in range(100)]
for i in range(2, 100):
	dp[i] = dp[i - 1] * i // gcd(dp[i - 1], i)
mod = 1000000007
for _ in range(t):
	n = int(input())
	m = 99
	for x in range(99, 0, -1):
		if dp[x] <= n:
			m = x
			break
	o = 0
	e = 0
	if n % 2 == 1:
		o = n // 2 + 1
		e = n - o
	else:
		o = n // 2
		e = n // 2
	total = 2 * o % mod
	temp = 0
	for x in range(m, 1, -1):
		total = (total + (n // dp[x] - temp) * (x + 1) % mod) % mod
		temp = n // dp[x]
	print(total)


import math
mod = 10 ** 9 + 7

def findgcd(a, b):
	while b:
		a %= b
		t = a
		a = b
		b = t
	return a

def findans():
	n = int(input())
	ans = 0
	lcm = 1
	i = 2
	while lcm <= n:
		l = int(n // lcm)
		lcm = int(lcm * i // math.gcd(lcm, i))
		r = int(n // lcm)
		ans += (l - r) * i
		i += 1
	ans %= mod
	return int(ans)

def main():
	t = int(input())
	ans = []
	while t != 0:
		cur = findans()
		ans.append(cur)
		t -= 1
	for it in ans:
		print(it)
main()


import os
import sys
from io import BytesIO, IOBase
_print = print
BUFSIZE = 8192

def dbg(*args, **kwargs):
	_print('\x1b[95m', end='')
	_print(*args, **kwargs)
	_print('\x1b[0m', end='')

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def inp():
	return sys.stdin.readline().rstrip()

def mpint():
	return map(int, inp().split(' '))

def itg():
	return int(inp())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
lcm = lambda a, b: a * b // gcd(a, b)
MOD = 10 ** 9 + 7
MAX = 10 ** 16
A051451 = [1, 2, 6]
_idx = 3
while A051451[-1] < MAX:
	_idx += 1
	A051451.append(lcm(A051451[-1], _idx))
TABLE = tuple(enumerate(A051451, 2))[::-1]

def solve():
	n = itg()
	ans = prev_count = 0
	for (f_i, a) in TABLE:
		count = n // a
		ans += f_i * (count - prev_count)
		prev_count = count
		ans %= MOD
	return ans

def main():
	for _ in range(itg()):
		print(solve())
DEBUG = 0
URL = 'https://codeforces.com/contest/1542/problem/C'
if DEBUG == 1:
	import requests
	from ACgenerator.Y_Test_Case_Runner import TestCaseRunner
	runner = TestCaseRunner(main, URL)
	inp = runner.input_stream
	print = runner.output_stream
	runner.checking()
else:
	if DEBUG != 2:
		dbg = lambda *args, **kwargs: ...
		(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	if DEBUG == 3:

		def print(*args, **kwargs):
			_print(*args, **kwargs)
			sys.stdout.flush()
	main()


T = int(input())
P = 1000000007

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
for k in range(T):
	n = int(input())
	ans = 0
	i = 2
	lcm = 1
	while n:
		d = gcd(lcm, i)
		lcm = lcm // d * i
		t = n * d // i
		ans += (n - t) * i
		ans %= P
		n = t
		i += 1
	print(ans)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
t = int(input())
for w in range(t):
	n = int(input())
	ans = 0
	d = 1
	i = 1
	while True:
		d = lcm(d, i)
		if d > n:
			break
		ans += n // d
		i += 1
	ans = (ans + n) % (10 ** 9 + 7)
	print(ans)


import math
mod = 10 ** 9 + 7

def lcm(a, b):
	return a * b // math.gcd(a, b)
t = int(input())

def func(n):
	a = 2 * n
	l = 1
	for k in range(2, 55):
		if l > n:
			break
		l = lcm(l, k)
		a += n // l % mod
	return a % mod
for _ in range(t):
	a = int(input())
	print(func(a))


n = 2
s = 3
ls = []
ls += [(1, 2)]
ls += [(n, s)]
lis = {}
while n < 10 ** 16:
	na = n
	while na % s != 0:
		na += n
	n = na
	while n % s == 0:
		s += 1
	ls += [(n, s)]
for i in ls:
	lis[i] = 0
t = int(input())
mod = 10 ** 9 + 7
for i in range(t):
	n = int(input())
	lis[ls[-1]] = n // ls[-1][0]
	maj = lis[ls[-1]]
	for i in range(len(ls) - 2, -1, -1):
		lis[ls[i]] = n // ls[i][0] - maj
		maj += lis[ls[i]]
	nat = 0
	for i in lis:
		nat = (nat + lis[i] * i[1]) % mod
	print(nat)


import math
for _ in range(int(input())):
	n = int(input())
	lcmm = 1
	rem = n
	ans = 0
	mod = 10 ** 9 + 7
	i = 2
	while True:
		bef = n // lcmm
		lcmm = lcmm * i // math.gcd(lcmm, i)
		aft = n // lcmm
		ans += (bef - aft) * i
		ans %= mod
		i += 1
		if lcmm > n:
			break
	print(ans)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 1
	right = x
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = lint()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	if n > 2:
		l.append(n)
	return l
t = I()
for _ in range(t):
	n = I()
	s = 1
	i = 2
	ans = n
	while s <= n:
		ans += n // s
		s = lcm(i, s)
		i += 1
	print(ans % (10 ** 9 + 7))


import string
from collections import deque, Counter, defaultdict
DEBUG = 0
checks = [3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41, 43]
points = [2, 6, 12, 60, 420, 840, 2520, 27720, 360360, 720720, 12252240, 232792560, 5354228880, 26771144400, 80313433200, 2329089562800, 72201776446800, 144403552893600, 5342931457063200, 219060189739591200]
assert len(checks) == len(points)
MOD = 10 ** 9 + 7

def f(n):
	if n == 0:
		return 0
	if n == 1:
		return 2
	last_p = 1
	last_c = 2
	s = 2
	for (p, c) in zip(points, checks):
		if p > n:
			break
		s = s * (p // last_p) + (c - last_c)
		last_p = p
		last_c = c
	return (f(n % last_p) + s * (n // last_p)) % MOD

def main():
	T = Input.read_typed(int)[0]
	while T:
		T -= 1
		n = Input.read_typed(int)[0]
		print(f(n))

class Input:

	def __init__(self):
		pass

	@staticmethod
	def read_typed(cls):
		return list(map(cls, input().split()))

	@staticmethod
	def read():
		return input()

class Debug:

	def __init__(self):
		import sys
		sys.stdout = open('output.out', 'w')
		sys.stdin = open('input.in', 'r')

	def __delete__(self):
		sys.stdout.close()
		sys.stdin.close()

def run():
	if DEBUG:
		_ = Debug()
	main()
run()


T = int(input())
MOD = 10 ** 9 + 7
from math import gcd
arr = [1]
n = 2
while arr[-1] < 10 ** 16:
	g = gcd(arr[-1], n)
	arr.append(arr[-1] * n // g)
	n += 1
for _ in range(T):
	N = int(input())
	ans = N
	for a in arr:
		ans += N // a
		ans %= MOD
	print(ans)


import math
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	s = 0
	lcm = 1
	i = 2
	if n == 1:
		print(2)
	elif n == 2:
		print(5)
	else:
		while lcm <= n:
			l = n // lcm
			lcm = lcm * i // math.gcd(lcm, i)
			r = n // lcm
			num = (l - r) * i % mod
			s = (s + num) % mod
			i += 1
		print(s)


import sys
from io import BytesIO, IOBase
import math

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().strip()

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	n = get_int()
	a = get_ints()
	cnt = 0
	for x in a:
		if x % 2 == 1:
			cnt += 1
	return yes_no(cnt == n).title()

def solve_b():
	(n, a, b) = get_ints()
	x = 1
	if b == 1:
		return True
	if a == 1:
		return n % b == 1
	while x <= n:
		if (n - x) % b == 0:
			return True
		else:
			x *= a
	return False

def solve_c():
	n = get_int()
	M = 10 ** 9 + 7
	S = n
	lcm = 1
	for i in range(1, 50):
		lcm = lcm * i // math.gcd(lcm, i)
		S += n // lcm
		S %= M
	return S
t = get_int()
for _ in range(t):
	print(solve_c())


def lcm(a, b):
	n = min(a, b)
	m = max(b, a)
	while n:
		temp = n
		n = m % n
		m = temp
	return a * b // m
z = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	sum = 0
	x = 1
	for i in range(2, 100):
		x = lcm(i - 1, x)
		sum += i * (n // x - n // lcm(x, i))
		sum %= z
		if x > n:
			break
	print(sum % z)


import math
import sys
input = iter(sys.stdin.read().splitlines()).__next__
MOD = 10 ** 9 + 7
memo = [0, 1]

def lcm_leq(i):
	if i >= len(memo):
		for j in range(len(memo), i + 1):
			memo.append(memo[-1] * j // math.gcd(memo[-1], j))
	return memo[i]

def solve():
	n = int(input())
	ret = n
	i = 1
	while True:
		lcm_leq_i = lcm_leq(i)
		if lcm_leq_i > n:
			break
		ret += n // lcm_leq_i
		i += 1
	return ret % MOD
t = int(input())
output = []
for _ in range(t):
	output.append(solve())
print(*output, sep='\n')


import math
MOD = pow(10, 9) + 7
t = int(input())
st = {}

def rlcm(x):
	if x in st:
		return st[x]
	if x == 1:
		return 1
	st[x] = x * rlcm(x - 1) // math.gcd(x, rlcm(x - 1))
	return st[x]
for case in range(t):
	n = int(input())
	i = 2
	c = 0
	s = 0
	while c < n:
		c += n // rlcm(i - 1) - n // rlcm(i)
		s += (n // rlcm(i - 1) - n // rlcm(i)) * i
		s %= MOD
		i += 1
	print(s)


import sys
import math
mod = 10 ** 9 + 7
LI = lambda : [int(k) for k in input().split()]
input = lambda : sys.stdin.readline().rstrip()
IN = lambda : int(input())
S = lambda : input()
r = range

def lcm(a, b):
	hcf = math.gcd(a, b)
	pro = a * b
	return pro // hcf
for t in r(IN()):
	n = IN()
	ans = n * 2
	ans %= mod
	div = 2
	ind = 3
	while div <= n:
		ans += n // div
		ans %= mod
		div = lcm(div, ind)
		ind += 1
	print(ans)


import math
MOD = 1000000007
t = int(input())
while t:
	n = int(input())
	a = n % MOD
	temp1 = 1
	temp2 = 1
	while temp1 <= n:
		a = (a + n // temp1 % MOD) % MOD
		temp2 += 1
		temp1 = temp1 * temp2 // math.gcd(temp1, temp2)
	print(a)
	t -= 1


def gcd(x, y):
	while y > 0:
		x %= y
		(x, y) = (y, x)
	return x

def lcm(x, y):
	return x // gcd(x, y) * y
t = int(input())
for __ in range(t):
	n = int(input())
	l = 1
	ans = 0
	for i in range(1, n + 1):
		l = lcm(l, i)
		if l > n:
			break
		ans += n // l
	print((ans + n) % (10 ** 9 + 7))


from collections import defaultdict, Counter
from math import sqrt, log10, log2, log, gcd, floor, factorial
from bisect import bisect_left, bisect_right
from itertools import combinations, combinations_with_replacement
import sys, io, os
input = sys.stdin.readline
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
mod = 10 ** 9 + 7
inf = float('inf')

def get_list():
	return [int(i) for i in input().split()]
yn = lambda a: print('YES' if a else 'NO')
ceil = lambda a, b: (a + b - 1) // b

def min_pos(n):
	for i in range(1, 10 ** 16):
		if n % i != 0:
			return i

def lcm(a, b):
	return a * b // gcd(a, b)
t = int(input())
for i in range(t):
	n = int(input())
	fac = 1
	counter = 2
	suma = n
	while fac <= n:
		suma += n // fac
		suma %= mod
		fac = lcm(fac, counter)
		counter += 1
	print(suma)


from sys import stdin, stdout
import math
t = int(stdin.readline())
lcm = [1, 2]

def prog_lcm(n):
	a = math.gcd(lcm[-1], n)
	lcm.append(lcm[-1] * n // a)
b = 3
while lcm[-1] <= 10 ** 16:
	prog_lcm(b)
	b += 1
for _ in range(t):
	n = int(input())
	ans = 0
	t = 0
	for i in range(len(lcm) - 1, -1, -1):
		w = n // lcm[i]
		k = (w - t) * (i + 2)
		if k > 0:
			ans += k
		t = n // lcm[i]
		ans = ans % (10 ** 9 + 7)
	print(ans)


def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	mod = 10 ** 9 + 7
	l = 1
	q = 1
	ans = 0
	while l <= n:
		ans = (ans + (n // l - n // lcm(l, q + 1)) * (q + 1)) % mod
		l = lcm(l, q + 1)
		q += 1
	print(ans)


from sys import stdin, stdout
input = stdin.readline
mod = 10 ** 9 + 7

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a // gcd(a, b) * b
t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	val = 1
	for i in range(2, 45):
		ans += (n // val - n // lcm(val, i)) * i
		ans %= mod
		val = lcm(i, val)
	print(ans)