X = int(input()) Y = int(input()) L = int(input()) rota = 0 gost = 0 if Y > 0: if X != 0: rota += 1 elif Y == 0: if X != 0: rota += 1 else: if X == 0: rota += 2 else: rota += 2 #print(rota) if X % L == 0: gost += abs(X // L) elif X < 0: gost += abs(X // L) else: gost += abs(x//L)+1 if Y % L == 0: gost += abs(Y //L) elif Y < 0 : gost += abs(Y//L) else: gost += abs(Y//L) +1 #print(gost) print(rota+gost)