Sequence j=1a+10b (j0=1,j1=2)
The sequence has j(0)=1, j(1)=2 and j(n)=1j(n−1)+10j(n−2). Print j(N) modulo 109+7.
Input: one integer N.
Output: j(N) mod 109+7.
Constraints:
- 0 ≤ N ≤ 1018
Sample Tests
Input 1
4
Output 1
152
Input 2
0
Output 2
1
Input 3
1
Output 3
2
Discussion (opens after you solve — no spoilers before)
No comments yet.