a, b = map(int, input().split()) ans = 0 while a > 0 and b > 0: ans += 2 a -= 1 b -= 1 print(ans)