if __name__ == "__main__": X = int(input()) Y = int(input()) L = int(input()) answer = 0 for num in [X, Y]: if num % L == 0: answer += abs(num) // L else: answer += abs(num) // L + 1 if Y < 0: answer += 2 elif X != 0: answer += 1 print(answer)