#include <bits/stdc++.h>
using namespace std;
const int maxn=4001;
const int inf=0x3f3f3f3f;
int n,a[maxn],dp[maxn][181][91][2];
int DP(int l,int d,int k,int f) {
if (dp[l][d][k][f]<-inf/2||dp[l][d][k][f]>inf/2)
return 0;
return dp[l][d][k][f];
}
// d = # Zhenya toke - # Igor toke
int dfs(int l,int d,int k,bool f) { // f:false Igor true Zhenya
if (dp[l][d][k][f]!=-1)
return DP(l,d,k,f);
//printf("(%d,%d,%d,%d)->%d\n",l,d-90,k,f,l+l+d-92);
if (l+l+d-92+k>n)
return 0;
if (!f) {// Igor
//printf("(%d,%d,%d,%d)->(%d,%d)\n",l,d,k,f,l+k-1,l-1);
dp[l][d][k][f]=dfs(l+k,d-k,k,!f)+a[l+k-1]-a[l-1];
if (l+l+d-92+k<n) dp[l][d][k][f]=max(dp[l][d][k][f],dfs(l+k+1,d-k-1,k+1,!f)+a[l+k]-a[l-1]);
} else { // Zhenya
//printf("(%d,%d,%d,%d)->(%d,%d)\n",l,d,k,f,n-d+90-l+1,n-d+90-l+1-k);
dp[l][d][k][f]=dfs(l,d+k,k,!f)+a[n-d+90-l-k+1]-a[n-d+90-l+1];
if (l+l+d-92+k<n) dp[l][d][k][f]=min(dp[l][d][k][f],dfs(l,d+k+1,k+1,!f)+a[n-d+90-l-k]-a[n-d+90-l+1]);
}
//printf("len=%d (%d,%d,%d,%d)->%d\n",l+l+d-92,l,d-90,k,f,DP(l,d,k,f));
return DP(l,d,k,f);
}
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;++i) {
scanf("%d",&a[i]);
a[i]+=a[i-1];
}
memset(dp,-1,sizeof dp);
printf("%d\n",dfs(1,90,1,0));
return 0;
}