x=int(input()) y=int(input()) k=int(input()) c=0 if x>0 and y>0: c+=1 if x>=0 and y<0: c+=2 y*=(-1) if x<0: c+=1 x*=(-1) if y<0: c+=1 y*=(-1) c+=(x//k) c+=(y//k) if x%k!=0: c+=1 if y%k!=0: c+=1 print(c)