Some sequences of bits (3) P59506


Statement
 

pdf   zip

thehtml

Write a program that prints the number of sequences made up of exactly z zeros and u 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 = 2 and u = 4:

001111   011011   011110   100111   101101   110011   110110   111001   111100

Input

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

Output

For every pair of z and u, 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