#include <stdio.h> int main() { int n; while(scanf("%d",&n)!=EOF){ double *p=(double *)malloc(sizeof(double)*n); for(int i=0;i<n;i++){ scanf("%lf",&p[i]); getchar(); } double max=p[0]; double answer=p[0]; for(int i=1;i<n;i++){ answer=(answer+p[i])>p[i]? (answer+p[i]):(p[i]); if(answer>max) max=answer; } printf("%.0lf\n",max); } return 0; }