x = int(input()) y = int(input()) l = int(input()) walk_h = 0 walk_w = 0 rotate = 0 if x == 0: walk_w = 0 elif x <= l: walk_w = 1 else: walk_w = abs(x // l) + abs(x % l) if y == 0: walk_h = 0 elif y <= l: walk_h = 1 else: walk_h = abs(y // l) + abs(y % l) if not x == 0: rotate += 1 elif x == 0 and y < 0: rotate += 2 print(walk_w + walk_h + rotate)