import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cn = new Scanner(System.in);
String s = cn.nextLine();
String[] words = s.split(", ");
int n = words.length;
int[] a = new int[words.length];
for(int i = 0 ; i < n ;i++){
a[i] = Integer.parseInt(words[i]);
//System.out.println(a[i]);
}
int[] dp = new int[1000];
dp[0] = a[0];
int res = a[0];
for(int j = 1 ; j < n ; j++) {
if( dp[j-1] < 0 )
dp[j] = a[j] ;
else
dp[j] = dp[j-1] + a[j] ;
res = Math.max(res,dp[j]);
}
System.out.println(res);
}
}