import math def main(): xy = list(map(int, input().split())) x = xy[0] y = xy[1] a1 = math.sqrt(x ** 2 + y ** 2) a2 = math.ceil(a1) a3 = a2 - a1 a4 = a2 * 2 if a3 == 0.0: print(a4 + 1) else: print(a4) if __name__ == "__main__": main()