print((-int(eval(input())) + int(eval(input())) * 2))

current_rating = int(eval(input()))

final_rating = int(eval(input()))

performance = final_rating * 2 - current_rating

print(performance)
print((-int(eval(input())) + int(eval(input())) * 2))

current_rating = int(eval(input()))
final_rating = int(eval(input()))
performance = final_rating * 2 - current_rating
print(performance)

-print((-int(eval(input())) + int(eval(input())) * 2)) +current_rating = int(eval(input())) +final_rating = int(eval(input())) +performance = final_rating * 2 - current_rating +print(performance)