#include <bits/stdc++.h>
using namespace std;
class AdditionAndSubtractionHard {
 public:
  int n;
  vector<long long> a;
  vector<string> op;
  vector<vector<long long> > dp;
  AdditionAndSubtractionHard() {
    cin >> n;
    op.push_back("+");
    for (int i = 0; i < 2 * n - 1; ++i) {
      if (i % 2 == 0) {
        long long tmp;
        cin >> tmp;
        a.push_back(tmp);
      } else {
        string tmpOp;
        cin >> tmpOp;
        op.push_back(tmpOp);
      }
    }
  }
  void exec() {
    dp.resize(n + 1);
    for (int i = 0; i < n; ++i) {
      dp[i].resize(2);
    }
    dp[0][0] = a[0];
    dp[0][1] = -1 * 1000000007;
    int flag = 0;
    for (int i = 1; i < n; ++i) {
      if (op[i] == "+") {
        dp[i][0] = max(dp[i - 1][0] + a[i], dp[i - 1][1] - a[i]);
        dp[i][1] = dp[i - 1][1] - a[i];
        if (flag) {
          dp[i][0] = max(dp[i][0], dp[i - 1][1] + a[i]);
          dp[i][1] = max(dp[i - 1][1] + a[i], dp[i][1]);
        }
      } else {
        dp[i][0] = max(dp[i - 1][0] - a[i], dp[i - 1][1] + a[i]);
        dp[i][1] = max(dp[i - 1][1] + a[i], dp[i - 1][0] - a[i]);
        if (flag >= 2) {
          dp[i][0] = max(dp[i][0], dp[i - 1][0] + a[i]);
          dp[i][1] = max(dp[i - 1][0] + a[i], dp[i][1]);
        }
        flag++;
      }
    }
    cout << max(dp[n - 1][0], dp[n - 1][1]) << endl;
  }
};
int main() {
  AdditionAndSubtractionHard aash = AdditionAndSubtractionHard();
  aash.exec();
}
