def interpolate_indices(x0, y0, x1, y1, x):
    """Linearly interpolate an int-valued function between points (`x0`, `y0`) and (`x1`, `y1`) and calculate its
    values at `x`."""
    return (y1 * (x - x0) + y0 * (x1 - x)) // (x1 - x0)