import math def main(): Xp, Yp = map(int, input().split()) r = math.hypot(Xp, Yp) d = int(r * 2) if d < r * 2: print(d) else: print(d - 1) main()