#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  long long ans;
  cin >> ans;
  vector<pair<char, long long>> a;
  for (long long i = 1; i < n; ++i) {
    char sgn;
    long long val;
    cin >> sgn >> val;
    a.emplace_back(sgn, val);
  }
  for (long long i = 0; i <= n; ++i) {
    if (i == n || a[i].first == '-') {
      a.erase(a.begin(), a.begin() + i);
      break;
    } else {
      ans += a[i].second;
    }
  }
  if (a.empty()) {
    cout << ans << endl;
    return 0;
  }
  n = a.size();
  ans -= a[0].second;
  for (long long i = 1; i <= n; ++i) {
    if (i == n || a[i].first == '-') {
      a.erase(a.begin(), a.begin() + i);
      break;
    } else {
      ans -= a[i].second;
    }
  }
  for (auto p : a) ans += p.second;
  cout << ans << endl;
  return 0;
}
