import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(",");
        int[] v = new int[s.length];
        for(int i = 0; i < s.length; ++i) v[i] = Integer.valueOf(s[i]);
        List<Integer> r = new ArrayList<>();
        for(int i = 0; i < v.length; ++i){//用i和j分别当左右指针,遍历所有区间
            int temp = v[i];
            r.add(temp);
            for(int j = i + 1; j < v.length; ++j){
                temp += v[j];
                r.add(temp);
            }
        }
        Collections.sort(r);
        int res = r.get(r.size() - 1);
        if(res <= 0) res = 0;//依据题意,最大值至少返回0
        System.out.println(res);
    }
}