#include<bits/stdc++.h>
using namespace std;
#define INF (1e8)
#define MAX 205
int n;
char s[MAX];

int dpA[MAX][MAX];
int dpB[MAX][MAX];
bool flgA[MAX][MAX];
bool flgB[MAX][MAX];

int solveA(int,int);
int solveB(int,int);

int main(){
  scanf("%s",s);
  n=strlen(s);
  int ans=solveA(0,n);
  assert( abs(ans) < 1e6 );
  printf("%d\n",ans);
  return 0;
}

int solveA(int l,int r){
  if(flgA[l][r])return dpA[l][r];
  flgA[l][r]=true;
  int res=-INF,cnt=0,num=0;
  int L=INF,R=-INF;
  for(int i=l;i<r;i++){
    if(s[i]<'0'||'9'<s[i])continue;
    L=min(L,i);
    R=max(R,i);
  }
  for(int i=l;i<r;i++){
    if(s[i]=='+'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=max(res, solveA(l,i)+solveA(i+1,r));
    }else if(s[i]=='-'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=max(res, solveA(l,i)-solveB(i+1,r));
    }else if('0'<=s[i]&&s[i]<='9'){
      cnt++;
      num=s[i]-'0';
    }
  }
  if(cnt==1)res=num;

    
  return dpA[l][r]=res;
}

int solveB(int l,int r){
  if(flgB[l][r])return dpB[l][r];
  flgB[l][r]=true;
  int res=INF,cnt=0,num=0;
  int L=INF,R=-INF;
  for(int i=l;i<r;i++){
    if(s[i]<'0'||'9'<s[i])continue;
    L=min(L,i);
    R=max(R,i);
  }
  
  for(int i=l;i<r;i++){
    if(s[i]=='+'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3<R &&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=min(res, solveB(l,i)+solveB(i+1,r));
    }else if(s[i]=='-'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=min(res, solveB(l,i)-solveA(i+1,r));
    }else if('0'<=s[i]&&s[i]<='9'){
      cnt++;
      num=s[i]-'0';
    }
  }
  if(cnt==1)res=num;
  return dpB[l][r]=res;
}
### Prompt

Please provide a Cpp coded solution 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>
using namespace std;
#define INF (1e8)
#define MAX 205
int n;
char s[MAX];

int dpA[MAX][MAX];
int dpB[MAX][MAX];
bool flgA[MAX][MAX];
bool flgB[MAX][MAX];

int solveA(int,int);
int solveB(int,int);

int main(){
  scanf("%s",s);
  n=strlen(s);
  int ans=solveA(0,n);
  assert( abs(ans) < 1e6 );
  printf("%d\n",ans);
  return 0;
}

int solveA(int l,int r){
  if(flgA[l][r])return dpA[l][r];
  flgA[l][r]=true;
  int res=-INF,cnt=0,num=0;
  int L=INF,R=-INF;
  for(int i=l;i<r;i++){
    if(s[i]<'0'||'9'<s[i])continue;
    L=min(L,i);
    R=max(R,i);
  }
  for(int i=l;i<r;i++){
    if(s[i]=='+'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=max(res, solveA(l,i)+solveA(i+1,r));
    }else if(s[i]=='-'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=max(res, solveA(l,i)-solveB(i+1,r));
    }else if('0'<=s[i]&&s[i]<='9'){
      cnt++;
      num=s[i]-'0';
    }
  }
  if(cnt==1)res=num;

    
  return dpA[l][r]=res;
}

int solveB(int l,int r){
  if(flgB[l][r])return dpB[l][r];
  flgB[l][r]=true;
  int res=INF,cnt=0,num=0;
  int L=INF,R=-INF;
  for(int i=l;i<r;i++){
    if(s[i]<'0'||'9'<s[i])continue;
    L=min(L,i);
    R=max(R,i);
  }
  
  for(int i=l;i<r;i++){
    if(s[i]=='+'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3<R &&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=min(res, solveB(l,i)+solveB(i+1,r));
    }else if(s[i]=='-'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=min(res, solveB(l,i)-solveA(i+1,r));
    }else if('0'<=s[i]&&s[i]<='9'){
      cnt++;
      num=s[i]-'0';
    }
  }
  if(cnt==1)res=num;
  return dpB[l][r]=res;
}
```