import math
X = int(input())
Y = int(input())
L = int(input())


def countNum(k, L):
    if k == 0:
        return 0
    elif (k % L) == 0:
        return int(k // L)
    else:
        return int((k // L) + 1)
countNum


def solve(X, Y, L):
    count = 0
    if X == 0 and Y == 0:
        return count
    elif Y >= 0:
        if X == 0:
            count = countNum(Y, L)
            return count
        else:
            X = abs(X)
            Y = abs(Y)
            count = countNum(X, L) + countNum(Y, L) + 1
            return count
    elif Y <= 0:
        if X == 0:
            Y = abs(Y)
            count += countNum(Y, L) + 2
            return count
        else:
            X = abs(X)
            Y = abs(Y)
            count = countNum(X, L) + countNum(Y, L) + 2
            return count
solve


num = solve(X, Y, L)
print(num)