No.1136 Four Points Tour
Problem Statement
There are $4$ points $\rm{A,B,C,D}$, and null-kun is currently at point $\rm{A}$. (For convenience, let the current time be second $0$.)
null-kun repeatedly moves, every $1$ second, to one of the $3$ points where he is not currently located. Find the number of ways of moving such that null-kun is at point $\rm{A}$ after $N$ seconds.
However, since the answer can be very large, output the remainder when divided by $10^9+7$.
Input
$N$
$1\le N \le 10^{18}$
$N$ is an integer.
However, test cases satisfying $10^6 < N$ do not affect the judgment of correctness. (They exist as evil cases.)
Output
Output the remainder of the answer when divided by $10^9+7$, followed by a newline.
Sample
Sample 1
Input
3
Output
6
- $\rm{A\rightarrow B\rightarrow C\rightarrow A}$
- $\rm{A\rightarrow B\rightarrow D\rightarrow A}$
- $\rm{A\rightarrow C\rightarrow B\rightarrow A}$
- $\rm{A\rightarrow C\rightarrow D\rightarrow A}$
- $\rm{A\rightarrow D\rightarrow B\rightarrow A}$
- $\rm{A\rightarrow D\rightarrow C\rightarrow A}$
Sample 2
Input
334
Output
724282422
Output the remainder when divided by $10^9+7$.
Sample 3
Input
1000000000000000000
Output
561584175
Test cases satisfying $10^6 < N \le 10^{18}$ do not affect the judgment of correctness for this problem.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
leafirby
null