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