#include <bits/stdc++.h>
using namespace std;
int N;
signed long long dp[101010][2];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  cin >> x;
  memset(dp, 0xcf, sizeof(dp));
  dp[0][0] = x;
  for (i = 0; i < (N - 1); i++) {
    cin >> s >> x;
    signed long long T[2];
    if (s == "+") {
      T[0] = dp[i][0];
      T[1] = dp[i][1];
    } else {
      T[0] = dp[i][1];
      T[1] = dp[i][0];
    }
    dp[i + 1][1] = T[1] - x;
    dp[i + 1][0] = max(dp[i + 1][1], T[0] + x);
  }
  cout << *max_element(dp[N - 1], dp[N - 1] + 3) << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
