#include #define DEBUG if(0) using namespace std; typedef long long LL; struct cww{cww(){ ios::sync_with_stdio(false);cin.tie(0); cout<inline void chmin(T &l,T r){l=min(l,r);} template inline void chmax(T &l,T r){l=max(l,r);} template istream& operator>>(istream &is,vector &v){ for(auto &it:v)is>>it; return is; } typedef vector V; typedef vector VV; const LL INF=1e16; int main(){ int N; cin>>N; V A(N);cin>>A; VV L(N+2,V(N+2,INF)); VV R(N+2,V(N+2,INF)); L[2][N]=A[0]; R[1][N-1]=A[N-1]; for(int len=N-2;len>=0;len--){ for(int l=0;l+len