X,Y,L=[int(input()) for _ in "..."] f=lambda x:(abs(x)+L-1)//L n=(X!=0,2)[Y<0]+f(X)+f(Y) print(n)