x, y = map(int, input().split()) if(x > y): tmp = x x = y y = tmp if(y - x == 4): print((y + 4) % 12) if(y - x == 8): print((x + y) // 2)