I want to make a summation of a summation. Precisely, given the picture, I have $i$ segments of length say $l_i$, and I divide them into subsets. In the picture, the starting of a new subset is marked with a solid dot. Mathematically, I suppose to separate the segments using a second index $j$. Each subset goes from $i=1,j$, to .. right before the value of $j$ changes. I would like to obtain the following, but I do not know how to properly express it.
$$S_{j}= \sum_{i=1}^{NewMark-1} (l_i-l_{i+1}+l_{i+2}-...)$$
And then
$$S_{j}-S_{j+1}+S_{j+2}-...=0$$
Suggestions are welcomed! Thank you

We can write for instance:
The $4$ solid vertices partition the graph into $4$ sections $\left(S_j\right)_{1\leq j \leq 4}$ with lengths $(4,1,2,3)$ summing up to a total of $10$. It is convenient to use double indices for the length of each subsection $l_{j,k}$ with $1\leq j\leq 4,1\leq k\leq S_j$.