import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        int length = arr.length;
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < length; i++) {
            if (arr[i] == '+' || arr[i] == '-' || arr[(i - 1 + length) % length] == '+' || arr[(i - 1 + length) % length] == '-') {
                continue;
            }
            int sum = 0;
            boolean isPlus = true;
            int tmp = 0;
            for (int j = 0; j < length; j++) {
                if (arr[(i + j) % length] == '+') {
                    if (isPlus) {
                        sum += tmp;
                    } else {
                        sum -= tmp;
                    }
                    isPlus = true;
                    tmp = 0;
                } else if (arr[(i + j) % length] == '-') {
                     if (isPlus) {
                        sum += tmp;
                    } else {
                        sum -= tmp;
                    }
                    isPlus = false;
                    tmp = 0;
                } else {
                    tmp *= 10;
                    tmp += arr[(i + j) % length] - '0';
                }
            }
            if (isPlus) {
                sum += tmp;
            } else {
                sum -= tmp;
            }
            max = Math.max(max, sum);
        }
        System.out.println(max);
    }
}