#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

char s[222];
int n;
bool lc[222],rc[222];
int dp[222][222][2];

int f(int l,int r,int flag){
  if(l+1==r)return s[l]-'0'; // num
  if(dp[l][r][flag]!=-INF-1)return dp[l][r][flag];

  int res=flag?INF:-INF;
  repl(i,l,r){
    if(s[i]!='+'&&s[i]!='-')continue;
    if((lc[i]&&i-2>=l)||(rc[i]&&i+2<r))continue;
    int op=s[i]=='+'?+1:-1;
    int lnum=f(l,i,flag),rnum=f(i+1,r,op==+1?flag:1-flag);
    if(!flag)maxch(res,lnum+op*rnum);
    else minch(res,lnum+op*rnum);
  }
  return dp[l][r][flag]=res;
}

int main(){
	cin.sync_with_stdio(false);
  cin>>s;
  n=strlen(s);
  rep(i,222)rep(j,222)rep(k,2)dp[i][j][k]=-INF-1;
  rep(i,n){
    if(i-2>=0&&(s[i]=='+'||s[i]=='-')&&s[i-2]=='(')lc[i]=true;
    if(i+2<n&&(s[i]=='+'||s[i]=='-')&&s[i+2]==')')rc[i]=true;
  }
  rep(i,n){
    if(s[i]=='('||s[i]==')')s[i]=0;
  }
  rep(i,n){
    if(s[i]!=0)continue;
    repl(j,i,n){
      if(s[j]==0)continue;
      s[i]=s[j];
      lc[i]=lc[j];
      rc[i]=rc[j];
      s[j]=0;
      break;
    }
  }
  n=strlen(s);
  cout<<f(0,n,0)<<endl;
	return 0;
}