On a segment starting at residual-score level t, an inactive score evolves as cj−haj while the active level is t−h. Solving cj−haj=±(t−h) gives distances (t−cj)/(1−aj) and (t+cj)/(1+aj). The smallest positive admissible distance determines the next entry; reaching level zero ends the algorithm.