R = int(eval(input()))

G = int(eval(input()))

print((2 * G - R))

R, G = int(eval(input())), int(eval(input()))

print((2 * G - R))

R = int(eval(input()))
G = int(eval(input()))
print((2 * G - R))

R, G = int(eval(input())), int(eval(input()))
print((2 * G - R))

-R = int(eval(input())) -G = int(eval(input())) +R, G = int(eval(input())), int(eval(input()))