double sum formulation 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

 A: We can write for instance:

Let $\left(S_j\right)_{1\leq j \leq 4}=(4,1,2,3)$. We consider
\begin{align*}
\sum_{j=1}^4\sum_{k=1}^{S_j} (-1)^{j+k}l_{j,k}
\end{align*}
...

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$.
A: Going step-by-step,
assuming that there are
arrays $i_0(j)$ and $i_1(j)$
that give the induces into
the $l_i$,
$S_{j}
= \sum_{i=i_0(j)}^{i_1(j)} (l_i-l_{i+1}+l_{i+2}-...)
= \sum_{i=i_0(j)}^{i_1(j)} \sum_{k=0}^{kmax} (-1)^kl_{i+k}
$
and,
with the same uncertainty
about how far $j$ goes,
$0
=S_{j}-S_{j+1}+S_{j+2}-...
=\sum_{h=0}^{jmax} (-1)^hS_{j+h}
$
so
$S_{j+h}
= \sum_{i=i_0(j+h)}^{i_1(j+h)} \sum_{k=0}^{kmax} (-1)^kl_{i+k}
$
so that
$\begin{array}\\
0
&=S_{j}-S_{j+1}+S_{j+2}-...\\
&=\sum_{h=0}^{jmax} (-1)^hS_{j+h}\\
&=\sum_{h=0}^{jmax} (-1)^h\sum_{i=i_0(j+h)}^{i_1(j+h)} \sum_{k=0}^{kmax} (-1)^kl_{i+k}\\
\end{array}
$
