Some sequences of bits (3) P59506


Statement
 

pdf   zip

Write a program that prints the number of sequences made up of exactly zz zeros and uu ones that are multiple of three when considered as a binary number. Note that numbers that begin with one or more zeros are allowed here.

For instance, there are 9 sequences for z=2z = 2 and u=4u = 4: 001111011011011110100111101101110011110110111001111100001111 \quad 011011 \quad 011110 \quad 100111 \quad 101101 \quad 110011 \quad 110110 \quad 111001 \quad 111100

Input

Input consists of several pairs of natural numbers zz and uu, each between 0 and 30.

Output

For every pair of zz and uu, print the required number.

Public test cases
  • Input

    0 0
    2 4
    30 30
    

    Output

    1
    9
    39433695205465102
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++ Python