def slucaj1(a, b): # a <= b <= c
    return 2*b - a

def slucaj2(a, b): # a <= c <= b
    return b

def slucaj3(a, b): # c <= a <= b
    return 2*a - b


a, b = map(int, input().split())

if a > b:
    a, b = b, a # a je uvek vece od b

c1 = slucaj1(a, b)
c2 = slucaj2(a, b)
c3 = slucaj3(a, b)

c = max(c1, c2, c3)

print(c)