x, y = map(int, input().split()) mi = min(x, y) d = abs(x-y) z = (mi - d + 12) % 12 print(z)