a,b = input().split()

a = int(a,16)
b = int(b,8)

print(a + b)