# -*- coding: utf-8 -*- import math xp, yp = map(int, input().split()) hypotenuses = pow(pow(xp,2)+pow(yp,2), 0.5) int_hypo = math.ceil(hypotenuses) diameter = 0 if pow(int_hypo,2) == (pow(xp,2)+pow(yp,2)): diameter = int_hypo*2 + 1 else: if int_hypo-0.5 > hypotenuses: diameter = int((int_hypo-0.5)*2) else: diameter = int_hypo*2 print(diameter)