a,b = map(int, raw_input().split()) if b > a: t = a a = b b = t for i in range(a,a*2): if i - a == b: print i break else: print a*2