{"raw_statement":[{"iden":"statement","content":"Consider the sequence of strings $F_1, F_2, \\\\dots$, defined as:\n\n$$ F_1 = ab\\text{,} $$ $$ F_{k+1} = F_kF_kb\\text{.} $$\n\nCalculate the number of distinct _subsequences_ of the string $F_n$ modulo $10^9 + 7$.\n\nThe first line of input contains a single integer $t$ ($1 <= t <= 10$), which is the number of test cases.\n\nThe second line of input contains $t$ integers $n$ ($1 <= n <= 10^(18)$), one for each test case.\n\nFor each test case, output the single integer which is the answer to the problem. Separate consecutive answers by single spaces.\n\nThe first three strings are: $F_1 = texttt(a b)$, $F_2 = texttt(a b a b b)$, and $F_3 = texttt(a b a b b a b a b b b)$.\n\n"},{"iden":"input","content":"The first line of input contains a single integer $t$ ($1 <= t <= 10$), which is the number of test cases.The second line of input contains $t$ integers $n$ ($1 <= n <= 10^(18)$), one for each test case."},{"iden":"output","content":"For each test case, output the single integer which is the answer to the problem. Separate consecutive answers by single spaces."},{"iden":"note","content":"The first three strings are: $F_1 = texttt(a b)$, $F_2 = texttt(a b a b b)$, and $F_3 = texttt(a b a b b a b a b b b)$."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ F_1 = \"ab\" $, and for $ k \\geq 1 $, define $ F_{k+1} = F_k F_k b $.  \nLet $ s_n = |F_n| $ denote the length of $ F_n $, and let $ a_n $ denote the number of distinct subsequences of $ F_n $.\n\n**Constraints**  \n1. $ 1 \\leq t \\leq 10 $  \n2. For each test case, $ 1 \\leq n \\leq 10^{18} $\n\n**Recurrence**  \nLet $ a_n $ be the number of distinct subsequences of $ F_n $.  \nThen:  \n- $ a_1 = 4 $ (subsequences of \"ab\": \"\", \"a\", \"b\", \"ab\")  \n- For $ n \\geq 1 $:  \n  $$\n  a_{n+1} = 2a_n + 1\n  $$\n\n**Objective**  \nFor each test case with input $ n $, compute $ a_n \\mod (10^9 + 7) $.","simple_statement":"Given a sequence of strings defined as:  \nF₁ = \"ab\",  \nFₖ₊₁ = Fₖ + Fₖ + \"b\",  \n\nFind the number of distinct subsequences in Fₙ, modulo 10⁹ + 7.  \n\nInput: t test cases, each with an integer n (1 ≤ n ≤ 10¹⁸).  \nOutput: Answer for each n, separated by spaces.","has_page_source":false}