#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> vr;
int a = 0;
while ( !(cin >> a).eof() )
{
vr.push_back(a);
}
typedef vector<int>::const_iterator IR;
int max = 0;
int present = 0;
IR i = vr.begin();
while ( i != vr.end() )
{
present += *i;
if ( present > max )
max = present;
if ( present < 0 )
present = 0;
i++;
}
cout << max << endl;
return 1;
}