X=int(input()) Y=int(input()) L=int(input()) f=lambda n:abs(n)//L+(1 if n%L else 0) if n else 0 print(f(X)+f(Y)+(2 if Y<0 else (1 if X else 0)))