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