How can I calculate
$\displaystyle\sum_{i_0=0}^x \sum_{i_1,\ldots, i_n=0}^1I_{i_1+ \cdots+i_n\leq x}\min\{i_0, i_1+ \cdots+ i_n\}$ as a function of $n,x$?
$I_{i_1+ \cdots+i_n\leq x}$ is indicator function which is 1 if $i_1+ \cdots+i_n\leq x$, else zero. Also $x<n$.
Now \begin{eqnarray} \displaystyle\sum_{i_0}^x \sum_{i_1,\ldots, i_n=0}^1I_{i_1+ \cdots+i_n\leq x}\min\{i_0, i_1+ \cdots+ i_n\}=\\ \sum_{i_1,\ldots, i_n=0}^1I_{i_1+ \cdots+i_n\leq x}\big( \sum_{i_0=0}^{i_1+\cdots+i_n}i_0 + \sum_{i_0=i_1+\cdots+i_n+1}^x i_1+ \cdots+ i_n\big ) \end{eqnarray}
But I can not proceed further due to indicator function. Kinly give me some hints.