Seraphina Coldwater is the most celebrated pastry chef of the Arcane Confectionery Guild. Her legendary cakes are not merely delicious — they are magical. Each cake requires exactly three ingredients, chosen from her enchanted pantry, where every ingredient is labeled with an enchantment level from 1 to N.
However, Seraphina is a perfectionist. She insists that a cake is only worth baking if its total enchantment — the sum of the three chosen ingredients' levels — is an even number. An odd total, she claims, makes the frosting curdle and the candles flicker in an unsettling fashion.
Being a meticulous record-keeper, Seraphina wants to know exactly how many distinct valid combinations she can bake. Since she respects each ingredient's individuality, she always picks three different ingredients, and she considers two selections identical if they contain the exact same trio regardless of order.
Given the size of her pantry N, help Seraphina count the number of valid triples $$$(a, b, c)$$$ with $$$1 \leq a \lt b \lt c \leq N$$$ such that $$$a + b + c$$$ is even.
As pantries can grow astronomically large, the answer may be an enormous number. Seraphina's enchanted ledger can only record values modulo $$$10^9 + 7$$$ — print the answer modulo $$$10^9 + 7$$$.
The first line contains a single integer $$$T$$$ $$$(1 \leq T \leq 10^5)$$$, the number of pantry configurations Seraphina wishes to evaluate.
Each of the next $$$T$$$ lines contains a single integer $$$N$$$ $$$(1 \leq N \leq 10^6)$$$, the number of ingredients available.
For each test case, print a single integer — the number of valid magical cake combinations, modulo $$$10^9 + 7$$$.
3347
1 2 19
21001000
80850 83083500
13
1