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