include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
const int N=110;
int n;
int f[N][N],w[N][N];
int main(){
cin>>n;
for(int i=1;i<=n;i){
for(int j=1;j<=i;j){
cin>>w[i][j];
}
}
for(int i=1;i<=n;i){
for(int j=1;j<=i;j){
f[i][j]=max(f[i-1][j]+w[i][j],f[i-1][j-1]+w[i][j]);
}
}
if(n%2==0) cout<<max(f[n][n/2+1],f[n][n/2]);
else cout<<f[n][n/2+1];
return 0;
}