2449: 隔板与水槽
[Creator : ]
Description

Input
第一行输入一个整数n。
接下来一行输入n个数,表示 aia_iai。
3≤n≤50003 \leq n \leq 50003≤n≤5000
1≤ai≤10000000001 \leq a_i \leq 10000000001≤ai≤1000000000
Output
一行一个整数,表示三个隔板所组成两个水槽的最大容积和。
Sample Input Copy
5
1 2 3 4 5
Sample Output Copy
8