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

d = G-R

print((G+d))

R = int(eval(input()))

G = int(eval(input()))

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

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

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