x, y = map(int, input().split()) if x > y: x, y = y, x if y - x == 4: print((y + 4) % 12) else: print((x + 4) % 12)