X = int(input()) Y = int(input()) L = int(input()) A = (abs(X)//L) + (abs(X)%L) B = (abs(Y)//L) + (abs(Y)%L) if X*Y<0: if Y<0: C =2 else: C =1 else: C = 1 print(A+B+C)