import math x, y = map(int, input().split()) r = (x**2 + y**2) ** 0.5 if r.is_integer(): print(int(2 * r + 1)) else: print(math.ceil(r) * 2)