import math x = int(input()) y = int(input()) moving = int(input()) count = 0 # where quadrant? if x == 0: count = 0 elif y >= 0: count = count + 1 else: count = count + 2 x, y = abs(x), abs(y) while x > 0: sep_x = math.floor(x / moving) count = count + sep_x x = x - sep_x * moving while y > 0: sep_y = math.floor(y / moving) count = count + sep_y y = y - sep_y * moving print(count)