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