#include <bits/stdc++.h>
using namespace std;
long long N;
long long A[100001];
char op[100001];
long long dp[3][100001];
int main() {
  cin >> N;
  op[0] = '+';
  for (int i = 0; i < N; ++i) {
    if (i != 0) {
      cin >> op[i];
    }
    cin >> A[i];
  }
  dp[0][0] = A[0];
  dp[1][0] = -0x3FFFFFFF;
  dp[2][0] = -0x3FFFFFFF;
  for (int i = 1; i < N; ++i) {
    if (op[i] == '-') {
      dp[0][i] = max(max(dp[0][i - 1] - A[i], dp[1][i - 1] + A[i]),
                     dp[2][i - 1] - A[i]);
      dp[1][i] = max(max(dp[1][i - 1] + A[i], dp[2][i - 1] - A[i]),
                     dp[0][i - 1] - A[i]);
      dp[2][i] = max(dp[2][i - 1] - A[i], dp[1][i - 1] + A[i]);
    } else {
      dp[0][i] = max(dp[0][i - 1] + A[i], dp[1][i - 1] - A[i]);
      dp[1][i] = max(dp[1][i - 1] - A[i], dp[2][i - 1] + A[i]);
      dp[2][i] = dp[2][i - 1] + A[i];
    }
  }
  cout << max(max(dp[0][N - 1], dp[1][N - 1]), dp[2][N - 1]) << endl;
  return 0;
}
