Forbidden Strings#1554

Forbidden Strings

1 seconde
128 mégaoctets
Très facile

A string consisting of the letters , , and is called forbidden if it contains three consecutive letters, one of which is , one is , and one is . For example, the string BAACAACCBAAA is forbidden, while AABBCCAABB is not.

Calculate the number of non-forbidden strings of length .

Entrée

Each line contains a single integer n~(1 \le n \le 30).

Sortie

For each input value of , print on a separate line the number of non-forbidden strings of length .

Exemples

Exemple 1

Loading
Loading