# Distribution such that the total number of balls of any five consecutive boxes is always the same.

Consider one the distribution of balls in boxes numbered from 1 to 2016. Assume that the distribution is such that the total number of balls of any five consecutive boxes is always the same. In the figure below is indicated the number of balls in some cases; The figure also shows two neighboring boxes has 3 and 7 balls. How many balls there in the last box?

My attempt Let $x_i$, $i=1,2,\ldots, 2016$ be the number of balls in the $i$-th box and $s$ is the sum of the number of balls in $5$ consecutive boxes. Then $x_1=?,x_2=5, x_3=9, x_4=1, x_5=?, x_{?}=3,x_{?+1}=7$ and $x_{2016}=?$ $$\begin{array}{l} (eq 1) \quad x_1+x_2+x_3+x_4+x_5=s\\ (eq 2) \quad x_2+x_3+x_4+x_5+x_6=s\\ (eq 3) \quad x_3+x_4+x_5+x_6+x_7=s\\ (eq 4) \quad x_4+x_5+x_6+x_7+x_8=s\\ (eq 5) \quad x_5+x_6+x_7+x_8+x_9=s\\ \hspace{3cm}\vdots \\ (eq ? ) \quad x_{?+1}+x_{?+2}+x_{?+3}+x_{?+4}+x_{?+5}=s\\ \hspace{3cm}\vdots \\ (eq 2011 ) \quad x_{2011+1}+x_{2011+2}+x_{2011+3}+x_{2011+4}+x_{2011+5}=s\\ \end{array}$$ I note that $$\sum_{i=0}^{2011}(-1)^{i}(x_{i+1}+x_{i+2}+x_{i+3}+x_{i+4}+x_{i+5})=0$$ implies $$x_1+5+9+1+x_5-x_{2012}-x_{2013}-x_{2014}-x_{2015}-x_{2016}=0$$

Since then I have tried to obtain a system with the same number of equations and variables.

HINT: Show by induction that the sequence $\langle x_1,\ldots,x_{2016}\rangle$ is periodic with period $5$. If you need more of a hint, check the spoiler-protected block below.
Thus, $x_{2016}=x_1$. Now figure out which of $3$ and $7$ $x_1$ must be.