X = list(map(int, input().split()))

K = sorted(X, reverse = True)

if K[0] - K[1] == 8:
    A = K[0] - 4
else:
    A = (K[0] + 4) % 12

print(A)