def main(): x = int(input()) y = int(input()) l = int(input()) step_x = 0 step_y = 0 def step(a): if abs(a) % l == 0: steps = abs(a) / l else: steps = abs(a) / l + 1 return int(steps) if y >= 0: ans = step(y) + step(x) + 1 else: ans = step(y) + step(x) + 2 print(ans) if __name__ == "__main__": main()