X = int(input()) Y = int(input()) L = int(input()) C = 0 def robot(XY, L): XY = divmod(abs(XY), L) if XY[1] == 0: return XY[0] else: return XY[0] + 1 if Y < 0: C += 2 else: if X != 0: C += 1 print(robot(X, L,) + robot(Y, L,) + C)