a, b = map(int, input().split()) d = a - b c = a + d if (a - b) == (c - a): print(c) else: print(b - d)