There are $n$ houses equidistantly placed on a circle. House $1$ is between house $n$ and house $2$, house $2$ is between house $1$ and house $3$ and so on. The distance between house $i$ and $j$ is $dis(i, j) = min(|i - j|, n - |i - j|)$.
There are $A_i$ friends living in house $i$. Every day you want to visit each friend once, so choose your house wisely to minimize your daily travel distance.
Mathematically speaking, choose your house $x$ so that: $$\sum_{i = 1}^{n}dis(i, x) \times A_i$$ is minimum.
Input:
3
1 0 2
Output:
1