Shortest path length with bounded-alternation (min, +) formulas