a, b = map(int, input().split()) if a < b: ans = 2*a-(b-a) elif a > b: ans = 2*b-(a-b) else: ans = 0 print(ans)