R=int(eval(input()))

G=int(eval(input()))

X=2*G-R



print(X)





R=int(eval(input()))

G=int(eval(input()))



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

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

-X = 2 * G - R -print(X) +print(((2 * G) - R))