"Raining Trees !"
MathModel is once again climbing "The Tree". The Tree is an infinite binary tree, rooted at , where each node (i \geq 1) has children and 2i + 1.
The uncle x = q(u) of node (u > 3) is the node that satisfies the following:
y = p(u)
p(x) = p(y) and x \neq y
^{\dagger}p(v) = \text{parent of node } v.
^{\dagger}q(v) = \text{uncle of node } v.
It can be shown that each node has only one uncle.
MathModel draws an edge between every node and its uncle .
An -good path is any path satisfying the following conditions:
The sum of nodes on the path equals .
For the set of nodes u_1, u_2, \ldots, u_m, it holds that u_1 < u_2 < u_3 < \ldots < u_m and u_i \in \{p(u_{i+1}), q(u_{i+1})\}.
MathModel wants you to find the number of -good paths for a given . Since the value might be large, print it modulo 10^9 + 7.
For more clarity, check the below example:
For u = 11, its parent is p(11) = 5.
Since p(4) = p(5) = 2, and 4 \neq 5, is considered the uncle of .
For n = 18, the following paths are valid:
11 \rightarrow 4 \rightarrow 2 \rightarrow 1
11 \rightarrow 5 \rightarrow 2
The first line of each test case contains a single integer (1 \leq t \leq 1000) — the number of test cases.
The only line of each test case contains a single integer (3 \leq n \leq 2 \cdot 10^{18}) — the desired sum of the subtree.
The count of such paths among all subtrees of "The Tree" modulo 10^9 + 7.
Example 1
For the first test case, there are two valid paths for n = 6:
(4 \rightarrow 2)
For the second test case, there are four valid paths for n = 7:
(4 \rightarrow 3)
(5 \rightarrow 2)
(4 \rightarrow 2 \rightarrow 1)
For the third test case, there are five paths for n = 8:
(5 \rightarrow 2 \rightarrow 1)
(4 \rightarrow 3 \rightarrow 1)
(5 \rightarrow 3)
(6 \rightarrow 2)
Subtask ( points): 3 \leq n \leq 30, t = 1.
Subtask ( points): 3 \leq n \leq 1000.
Subtask ( points): 3 \leq n \leq 10^6, t = 1.
Subtask ( points): 3 \leq n \leq 10^6, t \leq 100.
Subtask ( points): n = 10^9.
Subtask ( points): 3 \leq n \leq 10^9, t \leq 10.
Subtask ( points): n \leq 2 \cdot 10^{18}, t = 1.
Subtask ( points): No additional constraints