Weirestrass points in Principles of Algebraic Geometry. On page 274 we have the gap values of $p\in S$ where $S$ is a Riemann surface, these are listed as follows:
$$a_1 = 1 , a_2 = 2+\alpha_1 , \ldots , a_g = g+ \alpha_1 + \ldots \alpha_{g-1}$$
Now the weight of Weirestrass point $p$ is defined as $ W(p) = \sum a_k - k $.
Now, I don't understand how come we get in this specific case: $W(p) = \sum_{k=1}^{g-1} (g-k)\alpha_k$, where the $k$th term in the sum should be $a_k -k$, how did they arrive at this identity?
Thanks.

It's just a rearrangement of the sum. $$a_k - k = \sum_{j=1}^{k-1} \alpha _j$$
so 
$$W(p) = \sum_{k = 1}^{g} (a_k - k) = \sum_{k = 1}^{g} \sum_{j=1}^{k-1} \alpha _j = \sum_{j \leq g-1} (g-k) \alpha_j$$
because the term $\alpha_j$ occurs $g-k$ times in the double sum. 
