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