For a sequence a_1...na\_{1...n}a_1...n, define f(a)f(a)f(a) as f(a)=max_1≤l≤r≤n∑_i=lra_i.f(a) = \max\limits\_{1 \le l \le r \le n} \sum\limits\_{i = l}^{r} a\_i\text{.}f(a)=max_1≤l≤r≤n∑_i=lra_i.
Given a sequence b_1...nb\_{1...n}b_1...n, you need to permute b_1...nb\_{1...n}b_1...n to get b′_1...nb'\_{1...n}b′_1...n and minimize f(b′)f(b')f(b′).
The first line contains a single integer nnn (1≤n≤161 \le n \le 161≤n≤16).
The second line contains nnn integers a_1...na\_{1...n}a_1...n (∣a_i∣≤105|a\_i| \le 10^5∣a_i∣≤105).
Output the minimum possible f(b′)f(b')f(b′).