x = int(input()) y = int(input()) l = int(input()) ans = 0 if y == 0: if x == 0: print(0) exit() ans = 1 x = abs(x) elif x == 0: if y < 0: ans = 2 y = abs(y) else: if y > 0: ans = 1 else: ans = 2 x = abs(x) y = abs(y) print((x - 1) // l + (y - 1) // l + 2 + ans)