Recursion [0]


Recursion [0]

In this problem we'll be evaluating the recursive function GG, where G(0)=0G(0)=0, G(1)=1G(1)=1, and for anything larger:

G(n)=3×G(n1)+G(n2)G(n) = 3\times G(n-1) + G(n-2)

For example, G(2)=3G(2) = 3, G(3)=10G(3) = 10, G(4)=33G(4) = 33, and so on.

Since the number computed may be large, you should compute the value modulo 109+710^9+7

Input

Input will contain a single integer nn.

Output

Output should be a single integer, G(n)%109+7G(n) \% 10^9+7.

Constraints

  • 0n1060 \leq n \leq 10^6

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.