r = int(eval(input()))

g = int(eval(input()))

print((g*2 - r))
r, g = list(map(int, [eval(input()) for _ in range(2)]))

print((g*2 - r))
r = int(eval(input()))
g = int(eval(input()))
print((g * 2 - r))

r, g = list(map(int, [eval(input()) for _ in range(2)]))
print((g * 2 - r))

-r = int(eval(input())) -g = int(eval(input())) +r, g = list(map(int, [eval(input()) for _ in range(2)]))