import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] # 1辺の長さがdistの三角形に含まれる格子点の数(辺上を含む) def tri(dist): return (dist+2)*(dist+1)//2 # 1つの象限内の格子点を数える def cal(l,b,r,t,d): cor=[l+b,l+t,b+r,r+t] cor.sort() if d0 and y2>0:ans+=cal(max(0,x1),max(0,y1),x2,y2,d) if x1<0 and y2>0:ans+=cal(max(0,-x2),max(0,y1),-x1,y2,d) if x1<0 and y1<0:ans+=cal(max(0,-x2),max(0,-y2),-x1,-y1,d) if x2>0 and y1<0:ans+=cal(max(0,x1),max(0,-y2),x2,-y1,d) if y1<0 and y2>0:ans-=min(d,x2)-max(-d,x1)+1 if x1<0 and x2>0:ans-=min(d,y2)-max(-d,y1)+1 if y1<0 and y2>0 and x1<0 and x2>0:ans+=1 print(ans) main()