#include <bits/stdc++.h>
using namespace std;
int INF = 10000000;
int main(){
  string S;
  cin >> S;
  int L = S.size();
  vector<int> p;
  vector<char> op;
  for (int i = 0; i < L; i++){
    if ('0' <= S[i] && S[i] <= '9'){
      p.push_back(i);
    }
    if (S[i] == '+' || S[i] == '-'){
      op.push_back(S[i]);
    }
  }
  int N = p.size();
  vector<vector<int>> dpmax(N + 1, vector<int>(N + 1, -INF));
  vector<vector<int>> dpmin(N + 1, vector<int>(N + 1, INF));
  for (int i = 0; i < N; i++){
    dpmax[i][i + 1] = S[p[i]] - '0';
    dpmin[i][i + 1] = S[p[i]] - '0';
  }
  for (int r = 2; r <= N; r++){
    for (int i = 0; i <= N - r; i++){
      int j = i + r;
      for (int k = i + 1; k < j; k++){
        bool ok = true;
        if (k == i + 1){
          if (S[p[i] + 1] == ')'){
           ok = false;
          }
        }
        if (k == j - 1){
          if (S[p[k] - 1] == '('){
            ok = false;
          }
        }
        if (ok){
          if (op[k - 1] == '+'){
            dpmax[i][j] = max(dpmax[i][j], dpmax[i][k] + dpmax[k][j]);
            dpmin[i][j] = min(dpmin[i][j], dpmin[i][k] + dpmin[k][j]);
          }
          if (op[k - 1] == '-'){
            dpmax[i][j] = max(dpmax[i][j], dpmax[i][k] - dpmin[k][j]);
            dpmin[i][j] = min(dpmin[i][j], dpmin[i][k] - dpmax[k][j]);
          }
        }
      }
    }
  }
  cout << dpmax[0][N] << endl;
}

### Prompt

Generate a Cpp solution to the following problem:

Tunnel formula

One day while exploring an abandoned mine, you found a long formula S written in the mine. If you like large numbers, you decide to take out the choke and add `(` or `)` so that the result of the formula calculation is as large as possible. If it has to be a mathematical formula even after adding it, how many can it be at the maximum?

There is enough space between the letters, and you can add as many `(` or `)` as you like. If the final formula is a formula, you may write `(` or `)` so that the correspondence of the first parenthesis is broken (see Sample 2). Also, here, <expr> defined by the following BNF is called a mathematical formula. All numbers in the formula are single digits.


<expr> :: = "(" <expr> ")"
| <term> "+" <term>
| <term> "-" <term>
<term> :: = <digit> | <expr>
<digit> :: = "0" | "1" | "2" | "3" | "4"
| "5" | "6" | "7" | "8" | "9"


Constraints

* 3 ≤ | S | ≤ 200



S represents a mathematical formula.

Input Format

Input is given from standard input in the following format.


S


Output Format

Output the answer as an integer.

Sample Input 1


1- (2 + 3-4 + 5)


Sample Output 1


Five


1- (2 + 3- (4 + 5)) is the maximum.

Sample Input 2


1- (2 + 3 + 4)


Sample Output 2


0


(1- (2 + 3) + 4) is the maximum.

Sample Input 3


1- (2 + 3)


Sample Output 3


-Four


Note that 1- (2) + (3) is not the formula here.





Example

Input

1-(2+3-4+5)


Output

5

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int INF = 10000000;
int main(){
  string S;
  cin >> S;
  int L = S.size();
  vector<int> p;
  vector<char> op;
  for (int i = 0; i < L; i++){
    if ('0' <= S[i] && S[i] <= '9'){
      p.push_back(i);
    }
    if (S[i] == '+' || S[i] == '-'){
      op.push_back(S[i]);
    }
  }
  int N = p.size();
  vector<vector<int>> dpmax(N + 1, vector<int>(N + 1, -INF));
  vector<vector<int>> dpmin(N + 1, vector<int>(N + 1, INF));
  for (int i = 0; i < N; i++){
    dpmax[i][i + 1] = S[p[i]] - '0';
    dpmin[i][i + 1] = S[p[i]] - '0';
  }
  for (int r = 2; r <= N; r++){
    for (int i = 0; i <= N - r; i++){
      int j = i + r;
      for (int k = i + 1; k < j; k++){
        bool ok = true;
        if (k == i + 1){
          if (S[p[i] + 1] == ')'){
           ok = false;
          }
        }
        if (k == j - 1){
          if (S[p[k] - 1] == '('){
            ok = false;
          }
        }
        if (ok){
          if (op[k - 1] == '+'){
            dpmax[i][j] = max(dpmax[i][j], dpmax[i][k] + dpmax[k][j]);
            dpmin[i][j] = min(dpmin[i][j], dpmin[i][k] + dpmin[k][j]);
          }
          if (op[k - 1] == '-'){
            dpmax[i][j] = max(dpmax[i][j], dpmax[i][k] - dpmin[k][j]);
            dpmin[i][j] = min(dpmin[i][j], dpmin[i][k] - dpmax[k][j]);
          }
        }
      }
    }
  }
  cout << dpmax[0][N] << endl;
}

```