#include<iostream>
#include<algorithm>
using namespace std;
string s,t;
bool NOL[222],NOR[222];
int D[222][222],P[222][222];
bool ok[222][222];
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]>='0'&&s[i]<='9')
		{
			t+=s[i];
			if(i>0&&s[i-1]=='(')NOR[t.size()-1]=true;
			if(i+1<s.size()&&s[i+1]==')')NOL[t.size()-1]=true;
		}
		else if(s[i]=='+'||s[i]=='-')t+=s[i];
	}
	s=t;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]>='0'&&s[i]<='9')
		{
			ok[i][i+1]=true;
			D[i][i+1]=P[i][i+1]=s[i]-'0';
		}
	}
	for(int k=2;k<=s.size();k++)for(int i=0;i+k<=s.size();i++)
	{
		if(NOL[i]||NOR[i+k-1])continue;
		int d=-2e9,p=2e9;
		for(int j=i+1;j<i+k;j++)
		{
			if(!ok[i][j]||!ok[j+1][i+k])continue;
			if(s[j]=='+')
			{
				ok[i][i+k]=true;
				d=max(d,D[i][j]+D[j+1][i+k]);
				p=min(p,P[i][j]+P[j+1][i+k]);
			}
			else if(s[j]=='-')
			{
				ok[i][i+k]=true;
				d=max(d,D[i][j]-P[j+1][i+k]);
				p=min(p,P[i][j]-D[j+1][i+k]);
			}
		}
		if(ok[i][i+k])D[i][i+k]=d,P[i][i+k]=p;
	}
	cout<<D[0][s.size()]<<endl;
}


### 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<iostream>
#include<algorithm>
using namespace std;
string s,t;
bool NOL[222],NOR[222];
int D[222][222],P[222][222];
bool ok[222][222];
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]>='0'&&s[i]<='9')
		{
			t+=s[i];
			if(i>0&&s[i-1]=='(')NOR[t.size()-1]=true;
			if(i+1<s.size()&&s[i+1]==')')NOL[t.size()-1]=true;
		}
		else if(s[i]=='+'||s[i]=='-')t+=s[i];
	}
	s=t;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]>='0'&&s[i]<='9')
		{
			ok[i][i+1]=true;
			D[i][i+1]=P[i][i+1]=s[i]-'0';
		}
	}
	for(int k=2;k<=s.size();k++)for(int i=0;i+k<=s.size();i++)
	{
		if(NOL[i]||NOR[i+k-1])continue;
		int d=-2e9,p=2e9;
		for(int j=i+1;j<i+k;j++)
		{
			if(!ok[i][j]||!ok[j+1][i+k])continue;
			if(s[j]=='+')
			{
				ok[i][i+k]=true;
				d=max(d,D[i][j]+D[j+1][i+k]);
				p=min(p,P[i][j]+P[j+1][i+k]);
			}
			else if(s[j]=='-')
			{
				ok[i][i+k]=true;
				d=max(d,D[i][j]-P[j+1][i+k]);
				p=min(p,P[i][j]-D[j+1][i+k]);
			}
		}
		if(ok[i][i+k])D[i][i+k]=d,P[i][i+k]=p;
	}
	cout<<D[0][s.size()]<<endl;
}


```