mod=1000000007
for _ in range(int(input())):
	s = int(input())
	res=(2*(s+1)*(s+2)*(s+3))//3
	res-=((7*(s+1)*(s+3))//2)
	res+=8*(s+1)
	print((res-3)%mod)
1304466534cd7c0383daa097b19ec305a4950058
<mask token>

<mask token>
for _ in range(int(input())):
    s = int(input())
    res = 2 * (s + 1) * (s + 2) * (s + 3) // 3
    res -= 7 * (s + 1) * (s + 3) // 2
    res += 8 * (s + 1)
    print((res - 3) % mod)

mod = 1000000007
for _ in range(int(input())):
    s = int(input())
    res = 2 * (s + 1) * (s + 2) * (s + 3) // 3
    res -= 7 * (s + 1) * (s + 3) // 2
    res += 8 * (s + 1)
    print((res - 3) % mod)

mod=1000000007
for _ in range(int(input())):
	s = int(input())
	res=(2*(s+1)*(s+2)*(s+3))//3
	res-=((7*(s+1)*(s+3))//2)
	res+=8*(s+1)
	print((res-3)%mod)