import numpy as np

lst = []



R = int(eval(input()))

G = int(eval(input()))





ans = G - R + G

print(ans)
lst = []



R = int(eval(input()))

G = int(eval(input()))





ans = G - R + G

print(ans)
import numpy as np

lst = []
R = int(eval(input()))
G = int(eval(input()))
ans = G - R + G
print(ans)

lst = []
R = int(eval(input()))
G = int(eval(input()))
ans = G - R + G
print(ans)

-import numpy as np -