Walking to Sincheon Station, Sam (Small)

Count N-digit numbers using only digits 0, 1, 2 that are divisible by 3 and have no leading zero.

Easy3MathBrute forceCombinatoricsInterviewNo attempts yetTime limit2sMemory limit256 MB

Problem

Wookje loves the syllable sam, which is how Koreans read the number 3. He collects it wherever he finds it: insam (ginseng), hongsam (red ginseng), haesam (sea cucumber), Samsung, Lee Chunsam (李春森), Samsigi, samsisekki (three meals a day), nope-not-buying-that sam, sam and death, got-it sam, even Geumgangsam needs a meal first, walking to Sincheon Station sam, and above all il-i-sam (one two three). He ends half his sentences with sam too. So Wookje decided to play with the number 3.

Using only the digits 0, 1 and 2, build an NN digit multiple of 3. The number you build is a natural number, so it cannot start with 0. Count how many such numbers exist.

Input

The first line contains NN. (1N91 \le N \le 9)

Output

On the first line, print how many NN digit multiples of 3 can be written with the digits 0, 1 and 2 only.