x=int(input()) y=int(input()) l=int(input()) t=0 if (y<0): t+=2 y*=-1 if (x<0): x*=-1 elif (x<0): t+=1 x*=-1 x=x/l y=y/l if x!=int(x): t+=1 t+=int(x) if y!=int(y): t+=1 t+=int(y) print(t)