x = int(input()) y = int(input()) l = int(input()) order_counter = 0 move_counter = 0 rotation_counter = 0 # for rotation_counter if y != 0: if y < 0 and x != 0: rotation_counter += 1 elif y < 0 and x == 0: rotation_counter += 2 if x != 0: rotation_counter += 1 # for move_counter xy_list = [x,y] for i in xy_list: q,mod = divmod(abs(i),l) if mod == 0: move_counter += q else: move_counter += q+1 order_counter = rotation_counter + move_counter print(order_counter)