#include <bits/stdc++.h>
#define inf (long long)1e17
using namespace std;

long long n;
string s;
vector<vector<long long>> dpmax, dpmin;

long long solve(int l, int r);

int main() {
  cin >> s;
  n = s.size();
  dpmax.assign(n + 1, vector<long long>(n + 1, inf));
  dpmin.assign(n + 1, vector<long long>(n + 1, inf));
  cout << solve(0, n) << endl;
  return 0;
}

long long solve(int l, int r) {
  if(dpmax[l][r] != inf) return dpmax[l][r];
  bool ch = 1;
  // x))))))
  for(int i = l + 1; i < r; ++i)
    if(s[i] != ')') ch = 0;
  if(ch) return dpmax[l][r] = dpmin[l][r] = s[l] - '0';
  ch = 1;
  // ((((((x
  for(int i = l; i < r - 1; ++i)
    if(s[i] != '(') ch = 0;
  if(ch) return dpmax[l][r] = dpmin[l][r] = s[r - 1] - '0';
  // x)+y...
  if(r - l > 2 && s[l + 1] == ')')
    return dpmax[l][r] = -inf;
  // ...+y(x
  if(r - l > 2 && s[r - 2] == '(')
    return dpmax[l][r] = -inf;
  long long resmax = -inf, resmin = inf;
  for(int i = l; i < r; ++i)
    if(s[i] == '+') {
      resmax = max(resmax, solve(l, i) + solve(i + 1, r));
      resmin = min(resmin, dpmin[l][i] + dpmin[i + 1][r]);
    }
    else if(s[i] == '-') {
      solve(i + 1, r);
      resmax = max(resmax, solve(l, i) - dpmin[i + 1][r]);
      resmin = min(resmin, dpmin[l][i] - dpmax[i + 1][r]);
    }
  dpmin[l][r] = resmin;
  return dpmax[l][r] = resmax;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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>
#define inf (long long)1e17
using namespace std;

long long n;
string s;
vector<vector<long long>> dpmax, dpmin;

long long solve(int l, int r);

int main() {
  cin >> s;
  n = s.size();
  dpmax.assign(n + 1, vector<long long>(n + 1, inf));
  dpmin.assign(n + 1, vector<long long>(n + 1, inf));
  cout << solve(0, n) << endl;
  return 0;
}

long long solve(int l, int r) {
  if(dpmax[l][r] != inf) return dpmax[l][r];
  bool ch = 1;
  // x))))))
  for(int i = l + 1; i < r; ++i)
    if(s[i] != ')') ch = 0;
  if(ch) return dpmax[l][r] = dpmin[l][r] = s[l] - '0';
  ch = 1;
  // ((((((x
  for(int i = l; i < r - 1; ++i)
    if(s[i] != '(') ch = 0;
  if(ch) return dpmax[l][r] = dpmin[l][r] = s[r - 1] - '0';
  // x)+y...
  if(r - l > 2 && s[l + 1] == ')')
    return dpmax[l][r] = -inf;
  // ...+y(x
  if(r - l > 2 && s[r - 2] == '(')
    return dpmax[l][r] = -inf;
  long long resmax = -inf, resmin = inf;
  for(int i = l; i < r; ++i)
    if(s[i] == '+') {
      resmax = max(resmax, solve(l, i) + solve(i + 1, r));
      resmin = min(resmin, dpmin[l][i] + dpmin[i + 1][r]);
    }
    else if(s[i] == '-') {
      solve(i + 1, r);
      resmax = max(resmax, solve(l, i) - dpmin[i + 1][r]);
      resmin = min(resmin, dpmin[l][i] - dpmax[i + 1][r]);
    }
  dpmin[l][r] = resmin;
  return dpmax[l][r] = resmax;
}

```