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

#define int long long
using P = pair<int, int>;
const int INF = 1e9;

string s;
vector<vector<P> > dp;

P dfs(int l, int r) {
  if ( dp[l][r] != P(-INF, INF) ) {
    return dp[l][r];    
  }
  if ( l == r ) {
    return P(s[l]-'0', s[l]-'0');    
  }

  P ret = {-INF, INF};
  if ( s[l] == '(' && r-l >= 3 ) {
    P res = dfs(l+1, r);
    ret.first = max(ret.first, res.first);
    ret.second = min(ret.second, res.second);    
  }
  
  if ( s[r] == ')' && r-l >= 3 ) {
    P res = dfs(l, r-1);
    ret.first = max(ret.first, res.first);
    ret.second = min(ret.second, res.second);    
  }
  
  for ( int i = l+1; i < r; i++ ) {
    if ( s[i] == '+' ) {
      P res1 = dfs(l, i-1);
      P res2 = dfs(i+1, r);      
      ret.first = max(ret.first, res1.first+res2.first);
      ret.second = min(ret.second, res1.second+res2.second);      
    }
    if ( s[i] == '-' ) {
      P res1 = dfs(l, i-1);
      P res2 = dfs(i+1, r);      
      ret.first = max(ret.first, res1.first-res2.second);
      ret.second = min(ret.second, res1.second-res2.first);      
    }
  }

  return dp[l][r] = ret;  
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> s;

  int n = s.size();
  dp = vector<vector<P> >(n+1, vector<P>(n+1, P(-INF, INF)));

  cout << dfs(0, n-1).first << endl;  
  
  return 0;
}

