Open the locks
Tag(s):

## Dynamic Programming, Easy-Medium

Problem
Editorial
Analytics

Every lock sequence in hogwarts is a sequence of length N and contains digits from 0 - 9 . Now there is a constraint that each lock sequence will not contain two adjacent numbers such that they sum up to a prime number.

For example 9994 is an invalid sequence of lock because 9+4 = 13 but 13 is a prime number. 9993 is a valid sequence of lock beacuse there are no two adjacent numbers such that theys sum up to a prime number.

So for the given length N you have to count total possible lock sequences modulo 10^9+7

Input
First line contains a number N as input

Output
Output total locks possible as per the given constraints

Constraints
1≤ N ≤ 105

SAMPLE INPUT
2
SAMPLE OUTPUT
63
Explanation

There are 63 locks possible . 00 is also a valid lock sequence.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

## CODE EDITOR

Initializing Code Editor...