#include <iostream>
#include <stdlib.h>
//use recurrence way to find most biggest total
using namespace std;
int sum=0;
void print_value(int a[][110],int N) //printf the number
{
for(int row=1; row<=N; row++)
for(int line=1; line<=row; line++)
cin>>a[row][line];
}
void search(int a[][110], int i, int j, int N, int all) //find the most biggest number
{
all+=a[i][j];
if(i==N)
{
if(sum <all )
sum =all ;
return ;
}
search(a ,i+1 ,j ,N, all);
search(a ,i+1 ,j+1 ,N ,all);
}
int main()
{
int N;
cin>>N;
int value[110][110]={0};
print_value(value,N);
search(value ,1 ,1 ,N , 0);
cout<<sum<<endl;
return 0;
}