r,g=int(eval(input())),int(eval(input()))

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

print((eval(eval(input()) + "*-1+2*" + eval(input()))))

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