X, Y = map(int, input().split()) d = abs(X - Y) z = (max(X, Y) + d) % 12 print(z)