X = int(raw_input()) Y = int(raw_input()) L = int(raw_input()) ans = 0 def susumu(N): if N%L == 0: return N/L else: return N/L +1 if Y > 0: ans += susumu(Y) elif Y < 0: ans += susumu(-Y)+1 else: ans += susumu(Y) # 0 if X > 0: ans += susumu(X)+1 elif X < 0: ans += susumu(-X)+1 else: ans += susumu(X) # 0 print ans