What is the expected value of this process? There are $n$ piles each containing  $a_i$ stones.  In a sequence of moves, Alex chooses two neighbouring piles randomly (containing, say, $A$ and $B$ stones) and combines them to create a single pile with $A + B$ stones at the same place. Such a move also yields him  $A + B$ points. He does this repeatedly until there is one pile.
Alex's score is the sum of all points after all $ n-1$ moves. What is the expected value of Alex's score?
I am stuck at this.  I found there are $(n-1)!$ possible move sequences, but I couldn't find how many points we get in all possible ways.

For a closed-form solution, notice that the number of times $a_i$ is summed in all $\Gamma(n)$ possible move sequences is
$(H_{i-1}+H_{n-i})\Gamma(n)$
where $H_i$ is the $i^{\text{th}}$ harmonic number, with $H_0\equiv0$.
So Alex's expected score is
$\sum_i{a_i(H_{i-1}+H_{n-i})}$
This result matches the matrix provided by @whuber (with R):
f <- function(n) {
  h <- c(0, cumsum(1/seq_len(n - 1L)))
  (h + rev(h))*gamma(n)
}
m <- matrix(0, 8, 8)
m[upper.tri(m, TRUE)] <- unlist(lapply(1:8, f))
t(m)
#>       [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]
#> [1,]     0     0     0     0     0     0     0     0
#> [2,]     1     1     0     0     0     0     0     0
#> [3,]     3     4     3     0     0     0     0     0
#> [4,]    11    15    15    11     0     0     0     0
#> [5,]    50    68    72    68    50     0     0     0
#> [6,]   274   370   400   400   370   274     0     0
#> [7,]  1764  2364  2580  2640  2580  2364  1764     0
#> [8,] 13068 17388 19068 19740 19740 19068 17388 13068

