Problem: <image>

Input

The input contains two integers a1, a2 (0 ≤ ai ≤ 32), separated by a single space.

Output

Output a single integer.

Examples

Input

1 1


Output

0


Input

3 7


Output

0


Input

13 10


Output

1

Solution (in PYTHON3):

Solution:
replacements = {
    "A":"+BF-AFA-FB+",
    "B":"-AF+BFB+FA-",
    "+":"+",
    "-":"-",
    "F":"F",
}

def curve_sequence(n):
    if n==0:
        yield "A"
        return
    for t in curve_sequence(n-1):
        yield from replacements[t]

a, b = map(int, input().split())

def location(a, b):
    i = 0
    x, y = 0, 0
    direction = 0
    for move in curve_sequence(a):
        if i == b:
            return x, y
        
        if move == "+":
            direction += 1
            direction %= 4
        elif move == "-":
            direction -= 1
            direction %= 4
        
        if move != "F":
            continue

        i += 1

        if direction == 0:
            x += 1
        elif direction == 1:
            y += 1
        elif direction == 2:
            x -= 1
        else:
            y -= 1
    

print(*location(a, b))