#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
template <typename T>
T &chmin(T &a, const T &b) {
  return a = std::min(a, b);
}
template <typename T>
T &chmax(T &a, const T &b) {
  return a = std::max(a, b);
}
template <typename T>
int len(const T &x) {
  return x.size();
}
struct yes_no : std::numpunct<char> {
  string_type do_truename() const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};
void solve();
int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}
using namespace std;
int A[128000];
int B[128000];
void solve() {
  ll N;
  cin >> N;
  vector<int> idx;
  for (int i = 0; i < (int)(N); i++) {
    if (i > 0) {
      string op;
      cin >> op;
      if (op == "-") idx.push_back(i);
    }
    cin >> A[i];
  }
  for (int i = 0; i < (int)(N); i++) B[i + 1] = B[i] + A[i];
  ll sum = accumulate(A, A + N, 0LL);
  if (idx.empty()) {
    cout << sum << endl;
    return;
  }
  ll res = -1e18;
  int dec = 0;
  for (int i = 0; i < (int)(idx.size() - 1); i++) {
    chmax(res, sum - dec * 2 - (B[idx[i + 1]] - B[idx[i]]) * 2);
    dec += A[idx[i]];
  }
  chmax(res, sum - dec * 2 - A[idx.back()] * 2);
  cout << res << endl;
}
