#include <limits> using namespace std; int main()
{
int a[100];
int n = 0;
while (cin.peek() != '\n') cin >> a[n++];
int maxsum = INT_MIN;
int currsum = 0;
for (int i = 0; i < n; i++)
{
if (currsum < 0)
currsum = a[i];
else
currsum += a[i];
if (currsum > maxsum)
maxsum = currsum;
}
cout << maxsum << endl;
return 0;
}