Some sequences of bits (1) P81826


Statement
 

pdf   zip

Write a program that prints the number of sequences of length nn made up of only zeros and ones that do not contain two consecutive zeros nor three consecutive ones.

For instance, there are 7 sequences for n=5n = 5: 0101001011011011010110110110101101101010 \quad 01011 \quad 01101 \quad 10101 \quad 10110 \quad 11010 \quad 11011

Input

Input consists of several natural numbers nn, each between 0 and 150.

Output

For every nn, print the required number.

Public test cases
  • Input

    0
    1
    2
    3
    5
    150
    

    Output

    1
    2
    3
    4
    7
    3495391431926239764
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C C++ Python