Some sequences of bits (2) P34343


Statement
 

pdf   zip

thehtml

Write a program that prints the number of sequences made up of exactly z zeros and u ones that do not contain two consecutive zeros nor three consecutive ones.

For instance, there are 8 sequences for z = 3 and u = 4:

0101011   0101101   0110101   0110110   1010101   1010110   1011010   1101010

Input

Input consists of several pairs of natural numbers z and u, each between 0 and 90.

Output

For every pair of z and u, print the required number.

Public test cases
  • Input

    0 0
    1 1
    3 4
    65 90
    

    Output

    1
    2
    8
    2529372610666365912
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++