#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cin >> n;
const int maxlen = n;
int s[maxlen];
int arr[maxlen][maxlen];
for (int i = 0; i < maxlen; i++)
{
cin >> s[i];
}
////////////////////////////////////
//方案一
/*
for( int i = 0; i < maxlen; i++)
{
for (int j = 0; j < i; j++)
{
arr[j][i] = arr[j][i-1] + s[i];
}
arr[i][i] = s[i];
}
int max = 0;
for (int i = 0; i < maxlen; i++)
{
for (int j = 0; j <= i ; j++)
{
cout << arr[j][i] << " ";
if ( arr[j][i] > max)
{
max = arr[j][i];
}
}
cout << endl;
}
cout << max << endl;
*/
/////