#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const int INF = 1e8;
using namespace std;

int main(){
	string s;
	while(cin >> s){
		int mini[205][205];
		int maxi[205][205];
		rep(i,205) rep(j,205){
			mini[i][j] = INF;
			maxi[i][j] = -INF;
		}

		rep(i,s.size()){
			if(isdigit(s[i])){
				mini[i][i + 1] = maxi[i][i + 1] = s[i] - '0';
			}
		}

		range(w,3,s.size() + 1){
			rep(i,s.size() + 1 - w){
				int j = i + w;

				if(w > 3){
					if(s[i] == '('){
						maxi[i][j] = max(maxi[i][j], maxi[i + 1][j]);
						mini[i][j] = min(mini[i][j], mini[i + 1][j]);
						continue;
					}else if(s[j - 1] == ')'){
						maxi[i][j] = max(maxi[i][j], maxi[i][j - 1]);
						mini[i][j] = min(mini[i][j], mini[i][j - 1]);
						continue;
					}
				}

				range(k,i + 1,j - 1){
					if(s[k] == '-'){
						maxi[i][j] = max(maxi[i][j], maxi[i][k] - mini[k + 1][j]);
						mini[i][j] = min(mini[i][j], mini[i][k] - maxi[k + 1][j]);
					}else if(s[k] == '+'){
						//cout << i << ' ' << k << endl;
						//cout << maxi[i][k] << ' ' << maxi[i][k + 1] << endl;
						maxi[i][j] = max(maxi[i][j], maxi[i][k] + maxi[k + 1][j]);
						mini[i][j] = min(mini[i][j], mini[i][k] + mini[k + 1][j]);

					}
				}
			}
		}
		//rep(i,s.size() + 1){ rep(j,s.size() + 1){ cout << maxi[i][j] <<  ' '; } cout << endl; }
		cout << maxi[0][s.size()] << endl;
	}
}
### Prompt

Develop a solution in cpp to the problem described below:

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 range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const int INF = 1e8;
using namespace std;

int main(){
	string s;
	while(cin >> s){
		int mini[205][205];
		int maxi[205][205];
		rep(i,205) rep(j,205){
			mini[i][j] = INF;
			maxi[i][j] = -INF;
		}

		rep(i,s.size()){
			if(isdigit(s[i])){
				mini[i][i + 1] = maxi[i][i + 1] = s[i] - '0';
			}
		}

		range(w,3,s.size() + 1){
			rep(i,s.size() + 1 - w){
				int j = i + w;

				if(w > 3){
					if(s[i] == '('){
						maxi[i][j] = max(maxi[i][j], maxi[i + 1][j]);
						mini[i][j] = min(mini[i][j], mini[i + 1][j]);
						continue;
					}else if(s[j - 1] == ')'){
						maxi[i][j] = max(maxi[i][j], maxi[i][j - 1]);
						mini[i][j] = min(mini[i][j], mini[i][j - 1]);
						continue;
					}
				}

				range(k,i + 1,j - 1){
					if(s[k] == '-'){
						maxi[i][j] = max(maxi[i][j], maxi[i][k] - mini[k + 1][j]);
						mini[i][j] = min(mini[i][j], mini[i][k] - maxi[k + 1][j]);
					}else if(s[k] == '+'){
						//cout << i << ' ' << k << endl;
						//cout << maxi[i][k] << ' ' << maxi[i][k + 1] << endl;
						maxi[i][j] = max(maxi[i][j], maxi[i][k] + maxi[k + 1][j]);
						mini[i][j] = min(mini[i][j], mini[i][k] + mini[k + 1][j]);

					}
				}
			}
		}
		//rep(i,s.size() + 1){ rep(j,s.size() + 1){ cout << maxi[i][j] <<  ' '; } cout << endl; }
		cout << maxi[0][s.size()] << endl;
	}
}
```