import math xp, yp = [int(x) for x in input().split()] res = 0 r2 = xp * xp + yp * yp r_can = int(math.floor(math.sqrt(r2))) for r in range(r_can, 2 * 10**4): if r * r > r2: res = 2 * r break print(res)