r = int(eval(input()))

g = int(eval(input()))

x = (2*g) - r

print(x)
r = int(eval(input()))

g = int(eval(input()))

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

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

-x = (2 * g) - r -print(x) +print((r + (g - r) * 2))