#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
const pair<int, int> arienai = make_pair(inf, -inf);
bool vis[209][209]; pair<int, int> dp[209][209];
pair<int, int> solve(int l, int r, string& s) {
	if (r - l == 0) return arienai;
	if (r - l == 1) return('0' <= s[l] && s[l] <= '9' ? make_pair(int(s[l] - '0'), int(s[l] - '0')) : arienai);
	if (vis[l][r]) return dp[l][r];
	pair<int, int> ans = arienai;
	for (int i = l + 1; i < r - 1; ++i) {
		if (s[i] == '+') {
			pair<int, int> lc = solve(l, i, s);
			pair<int, int> rc = solve(i + 1, r, s);
			if (lc != arienai && rc != arienai) {
				ans.first = min(ans.first, lc.first + rc.first);
				ans.second = max(ans.second, lc.second + rc.second);
			}
		}
		if (s[i] == '-') {
			pair<int, int> lc = solve(l, i, s);
			pair<int, int> rc = solve(i + 1, r, s);
			if (lc != arienai && rc != arienai) {
				ans.first = min(ans.first, lc.first - rc.second);
				ans.second = max(ans.second, lc.second - rc.first);
			}
		}
	}
	for (int i = 1; i < 4; ++i) {
		if ((i & 1) && s[l] != '(') continue;
		if ((i & 2) && s[r - 1] != ')') continue;
		pair<int, int> res = solve(l + (i & 1 ? 1 : 0), r - (i & 2 ? 1 : 0), s);
		if (res != arienai && (r - (i & 2 ? 1 : 0)) - (l + (i & 1 ? 1 : 0)) >= 2) {
			ans.first = min(ans.first, res.first);
			ans.second = max(ans.second, res.second);
		}
	}
	vis[l][r] = true;
	dp[l][r] = ans;
	return ans;
}
int main() {
	string s;
	cin >> s;
	pair<int, int> ans = solve(0, s.size(), s);
	cout << ans.second << endl;
	return 0;
}

### Prompt

In Cpp, your task is to solve 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 <string>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
const pair<int, int> arienai = make_pair(inf, -inf);
bool vis[209][209]; pair<int, int> dp[209][209];
pair<int, int> solve(int l, int r, string& s) {
	if (r - l == 0) return arienai;
	if (r - l == 1) return('0' <= s[l] && s[l] <= '9' ? make_pair(int(s[l] - '0'), int(s[l] - '0')) : arienai);
	if (vis[l][r]) return dp[l][r];
	pair<int, int> ans = arienai;
	for (int i = l + 1; i < r - 1; ++i) {
		if (s[i] == '+') {
			pair<int, int> lc = solve(l, i, s);
			pair<int, int> rc = solve(i + 1, r, s);
			if (lc != arienai && rc != arienai) {
				ans.first = min(ans.first, lc.first + rc.first);
				ans.second = max(ans.second, lc.second + rc.second);
			}
		}
		if (s[i] == '-') {
			pair<int, int> lc = solve(l, i, s);
			pair<int, int> rc = solve(i + 1, r, s);
			if (lc != arienai && rc != arienai) {
				ans.first = min(ans.first, lc.first - rc.second);
				ans.second = max(ans.second, lc.second - rc.first);
			}
		}
	}
	for (int i = 1; i < 4; ++i) {
		if ((i & 1) && s[l] != '(') continue;
		if ((i & 2) && s[r - 1] != ')') continue;
		pair<int, int> res = solve(l + (i & 1 ? 1 : 0), r - (i & 2 ? 1 : 0), s);
		if (res != arienai && (r - (i & 2 ? 1 : 0)) - (l + (i & 1 ? 1 : 0)) >= 2) {
			ans.first = min(ans.first, res.first);
			ans.second = max(ans.second, res.second);
		}
	}
	vis[l][r] = true;
	dp[l][r] = ans;
	return ans;
}
int main() {
	string s;
	cin >> s;
	pair<int, int> ans = solve(0, s.size(), s);
	cout << ans.second << endl;
	return 0;
}

```