Chef's pizza is the tastiest pizza to exist, and the reason for that is his special, juicy homegrown tomatoes. 
Tomatoes can be grown in rectangular patches of any side lengths. However, Chef only has a limited amount of land. 
Consider the entire town of Chefville to be consisting of cells in a rectangular grid of positive coordinates. 
Chef own all cells (x,y)$(x, y)$ that satisfy x∗y≤N$x*y \leq N$
As an example if N=4$N = 4$, Chef owns the following cells: 
(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(3,1),(4,1)$(1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 2), (3, 1), (4, 1) $
Chef can only grow tomatoes in rectangular patches consisting only of cells which belong to him. Also, if he uses a cell, he must use it entirely. He cannot use only a portion of it. 
Help Chef find the number of unique patches of rectangular land that he can grow tomatoes in! Since this number can be very large, output it modulo 1000000007$1000000007$.

-----Input:-----
- The first line of the input contains T$T$, the number of test cases.
- The next T$T$ lines of input contains one integer N$N$.

-----Output:-----
For each testcase, output the number of ways modulo 1000000007$1000000007$.

-----Constraints-----
- 1≤T≤5$1 \leq T \leq 5$
- 1≤N≤1010$1 \leq N \leq 10^{10}$

-----Sample Input:-----
2
4
10000000000

-----Sample Output:-----
23
227374950

Source: codechef | Difficulty: VERY_HARD


Solutions:
import numpy as np
import math
import sys
import time
MOD = 1000000007

def stack(n, x, l):
	return x * l * (l + 1) * (x + 2 * n + 1) // 4 % MOD

def heightsGen(n):
	(lengths, heights) = ([1], [n])
	for i in range(2, int(math.sqrt(n)) + 1):
		h = n // i
		if h == heights[-1]:
			lengths[-1] == i
		else:
			heights.append(h)
			if i != h:
				lengths.append(i)
	lengths.extend(reversed(heights))
	return lengths
for i in range(int(input())):
	N = int(input())
	heights = np.array(list(heightsGen(N))).astype(np.int64)
	ns = np.mod(heights[:-1], MOD)
	xs = np.mod(heights[1:] - heights[:-1], MOD)
	ls = ns[::-1]
	counter = N * (N + 1) // 2
	for i in range(len(ns)):
		counter += stack(int(ns[i]), int(xs[i]), int(ls[i]))
		counter %= MOD
	print(counter)


from math import *

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

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

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

def g(n):
	return n * (n + 1) * (2 * n + 1) // 6

def f(n):
	ans = 0
	for i in range(1, floor(sqrt(n)) + 1):
		ans += i * (i + floor(n / i)) * (floor(n / i) + 1 - i)
	return ans - g(floor(sqrt(n)))
for _ in range(int(input())):
	n = int(input())
	print(f(n) % 1000000007)


import math
Mod = 1000000007
for _ in range(int(input())):
	v = int(input())
	i = 0
	s = 0
	for i in range(1, math.floor(math.sqrt(v)) + 1):
		s += i * (math.floor(v / i) * (math.floor(v / i) + 1) - i * (i - 1))
		s -= i * i
	print(s % Mod)


from math import *
Mod = 1000000007

def getRect(x, y):
	return x * (x + 1) * y * (y + 1) // 4

def f(n):
	tot = 0
	for i in range(1, floor(sqrt(n)) + 1):
		y = floor(n / i)
		tot += getRect(i, y) - getRect(i - 1, y)
	tot = 2 * tot
	sub = getRect(floor(sqrt(n)), floor(sqrt(n)))
	return tot - sub
for _ in range(int(input())):
	n = int(input())
	print(f(n) % 1000000007)


from math import *

def pair(x, y):
	return x * (x + 1) * y * (y + 1) // 4

def f(n):
	t = 0
	for i in range(1, floor(sqrt(n)) + 1):
		x = floor(n / i)
		t += pair(i, x) - pair(i - 1, x)
	t = 2 * t
	p = pair(floor(sqrt(n)), floor(sqrt(n)))
	return t - p
for _ in range(int(input())):
	n = int(input())
	m = f(n) % 1000000007
	print(m)


import math as m
mod = 1000000007
for t in range(int(input())):
	n = int(input())
	ans = 0
	for i in range(1, m.floor(m.sqrt(n)) + 1):
		ans += i * (m.floor(n / i) * (m.floor(n / i) + 1) - i * (i - 1))
		ans -= i * i
	print(ans % mod)


import math
d = 1000000007
for _ in range(int(input())):
	n = int(input())
	re = 0
	for x in range(1, int(math.sqrt(n)) + 1):
		t = int(n / x)
		re += (x * t * (t + 1) - x * x * (x - 1) - x * x) % d
		re %= d
	print(re)


from math import sqrt, floor
modal = 1000000007

def recCount(n):
	return sum([x * (floor(n / x) ** 2 + floor(n / x) - x ** 2) for x in range(1, floor(sqrt(n)) + 1)])
for i in range(int(input())):
	print(recCount(int(input())) % modal)


import sys, math
t = int(sys.stdin.readline())
for jj in range(0, t):
	x = int(sys.stdin.readline())
	k = math.floor(math.sqrt(x))
	k1 = k * (k + 1) * (2 * k + 1)
	k1 //= 6
	ctr = 0
	for i in range(1, k + 1):
		kk1 = i * (i + x // i) * (x // i + 1 - i)
		ctr += kk1
	ctr -= k1
	print(ctr % 1000000007)