import sys a, b = map(int, sys.stdin.readline().split()) d = abs(a - b) # print(d) if d == 4: print((max(a,b) + 4) % 12) else: print((min(a,b) + 4) % 12)