import std.algorithm;
import std.ascii;
import std.array;
import std.container;
import std.conv;
import std.numeric;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}
int size(T)(in T s) {
    return cast(int)s.length;
}

const int INF = 10000;

int op(char c, int a, int b) {
    if (c == '+') return a + b;
    if (c == '-') return a - b;
    assert(false);
}

int next_op_index(in string s, int i) {
    for (int j = i; j < s.size; j++) {
        if (s[j] == '+' || s[j] == '-') return j;
    }
    throw new Exception("");
}
int prev_op_index(in string s, int i) {
    for (int j = i; j >= 0; j--) {
        if (s[j] == '+' || s[j] == '-') return j;
    }
    throw new Exception("");
}

void main() {
    string s = readln.chomp;

    auto t_index = new int[s.size]; t_index[] = -1;
    int cur = 0;
    foreach (i, c; s) {
        if (c == '(' || c == ')') continue;
        t_index[i] = cur++;
    }
    auto buf = new char[cur];
    foreach (i, c; s) {
        if (c == '(' || c == ')') continue;
        buf[t_index[i]] = c;
    }
    string t = buf.idup;

    int N = t.size;
    auto open_banned = new bool[N];
    auto close_banned = new bool[N];
    foreach (int i, c; s) {
        try {
            if (c == '(')      close_banned[t_index[next_op_index(s, i)]] = true;
            else if (c == ')') open_banned[t_index[prev_op_index(s, i)]] = true;
        } catch (Exception e) {}
    }

    auto dp_min = new int[][](N + 1, N + 1);
    auto dp_max = new int[][](N + 1, N + 1);
    foreach (ref a; dp_max) a[] = -INF;
    foreach (ref a; dp_min) a[] = INF;
    foreach (i, c; t) {
        if (c.isDigit) dp_max[i][i + 1] = dp_min[i][i + 1] = cast(int)(c - '0');
    }

    for (int k = 2; k <= N; k++) {
        for (int i = 0; i + k <= N; i++) {
            for (int j = i + 1; j < i + k; j++) {
                if (! (t[j] == '+' || t[j] == '-')) continue;
                int lcount = cast(int)t[i .. j].count!isDigit;
                int rcount = cast(int)t[j .. i + k].count!isDigit;
                if (lcount >= 2 && close_banned[j]) continue;
                if (rcount >= 2 && open_banned[j]) continue;
                switch (t[j]) {
                    case '+':
                        dp_max[i][i + k] = max(dp_max[i][i + k], dp_max[i][j] + dp_max[j + 1][i + k]);
                        dp_min[i][i + k] = min(dp_min[i][i + k], dp_min[i][j] + dp_min[j+ 1][i + k]);
                        break;
                    case '-':
                        dp_max[i][i + k] = max(dp_max[i][i + k], dp_max[i][j] - dp_min[j + 1][i + k]);
                        dp_min[i][i + k] = min(dp_min[i][i + k], dp_min[i][j] - dp_max[j + 1][i + k]);
                        break;
                    default:
                        break;
                } 
            }
        }
    }
    /*
    foreach (L; dp_max) log(L);
    log();
    foreach (L; dp_min) log(L);
    */
    writeln(dp_max[0][t.size]);
}