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 N digit multiple of 3. The number you build is a natural number, so it cannot start with 0. Count how many such numbers exist.