#P2012. 拯救世界2

拯救世界2

Description

After 12 years of hiding their strength, the end of the world comes again (everyone: what kind of logic is that...).

This time, xiao a and uim have prepared everything and successfully summoned the gurus kkksc03 and lzn. However, kkksc03 and lzn told them that this doomsday is too powerful to reverse. Only the Creator God JOHNKRAM can save the world.

But the Creator God JOHNKRAM cannot be summoned, unless the entire universe is converted into energy according to E=mc2E=mc^2. Based on the summoning law casually derived by the guru C_SUNSHINE, at least one quadrillionth of the summonee’s energy is required to summon them (everyone: what kind of law is that...).

Of course, there is another way: find the genetic sequence of the Creator God JOHNKRAM. A normal human gene sequence consists of A, C, G, T. The Creator God JOHNKRAM is not a normal person (he’s a chubby guy), so his genetic sequence is different. Besides these four ordinary ones, there are eight special genes: 乾 (Qian), 兑 (Dui), 离 (Li), 震 (Zhen), 巽 (Xun), 坎 (Kan), 艮 (Gen), 坤 (Kun). Among them, 乾, 坎, 艮, 震 are “yang” and can only appear an odd number of times; 坤, 兑, 离, 巽 are “yin” and can only appear an even number of times.

Now we only know that the Creator God JOHNKRAM’s genetic sequence has nn positions; nothing else is known. xiao a and uim want to know the maximum number of attempts they would need in order to summon the Creator God JOHNKRAM. This number can be large, so output the answer modulo 10910^9 (C_SUNSHINE’s advice: stay away from the Eight Trigrams, stay away from obesity).

Input Format

Multiple test cases. Each test case contains a single integer nn on one line. Input terminates with 00.

Output Format

For each test case, output a single integer on one line: the answer modulo 10910^9.

3
10
20
6
0
0
225116160
53238784
7680

Hint

Constraints
For 10%10\% of the testdata: 1n<251 \le n < 25, the number of test cases does not exceed 1010.
For 50%50\% of the testdata: 1n<2311 \le n < 2^{31}, the number of test cases does not exceed 10310^3.
For 100%100\% of the testdata: 1n<2631 \le n < 2^{63}, the number of test cases does not exceed 2×1052 \times 10^5.

Sample Explanation
Explanation for the first sample:
There are only 33 positions, so there is no valid configuration. The answer is 00.

Notes

Attachment: chat log (pure nonsense)

JOHNKRAM 8:50:33
Hey hey, can the Pit God Contest 2 start now?

C_SUNSHINE 8:50:34
[Auto-reply] En!

JOHNKRAM 8:51:12
I’m planning to raise the last problem’s range from 5050 to 2632^{63}.

C_SUNSHINE 8:51:12
[Auto-reply] En!

JOHNKRAM 8:51:45
You agree?

C_SUNSHINE 8:51:46
[Auto-reply] En!

C_SUNSHINE 11:58:50
Are you crazy?!

JOHNKRAM 11:58:52
[Auto-reply] Hello, I’m busy right now and will get back to you later. Do not remind again.

Translated by ChatGPT 5