x = int(input()) y = int(input()) l = int(input()) #方向転換 step = 2 if y>=0: step -= 1 if x==0 and y>0: step -= 1 if x==0 and y==0: step = 0 #真っ直ぐ step += abs(int(x/l)) + abs(int(y/l)) if x%l>0: step += 1 if y%l>0: step += 1 print(step)