# -*- coding:utf-8 -*- import math if __name__ == "__main__": x,y = map(int,raw_input().split()) dist = math.sqrt(x ** 2 + y ** 2) dist2 = round(dist,0) if dist2 <= dist: print int(dist2 * 2 +1) else: print int(dist2 * 2)