import math if __name__ == '__main__': xy = list(map(int, input().split())) x, y = xy[0], xy[1] hypotenuse = math.sqrt(x ** 2 + y ** 2) if hypotenuse == int(hypotenuse): print(int(hypotenuse) * 2 + 1) else: print(math.ceil(hypotenuse) * 2)