import math x,y=map(int,input().split()) z=math.sqrt((x*x)+(y*y)) z_i=math.ceil(z) if z_i==int(z): print(z_i*2+1) else: print(z_i*2)