#include <bits/stdc++.h>
using namespace std;
const int MN = 100010;
int N;
int A[MN];
char B[MN];
long long dp[MN][3];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    if (i) {
      scanf(" %c", &B[i]);
    }
    scanf("%d", &A[i]);
  }
  if (N == 1) {
    printf("%d", A[0]);
    return 0;
  }
  dp[N - 1][0] = B[N - 1] == '+' ? A[N - 1] : -A[N - 1];
  dp[N - 1][1] = B[N - 1] == '+' ? -A[N - 1] : A[N - 1];
  dp[N - 1][2] = abs(A[N - 1]);
  for (int i = N - 2; i >= 1; i--) {
    if (B[i] == '+') {
      dp[i][0] = A[i] + dp[i + 1][0];
      dp[i][1] = -1e18;
      dp[i][2] = -1e18;
      for (int j = 0; j < 3; j++) {
        dp[i][1] = max(dp[i][1], -A[i] + dp[i + 1][j]);
        dp[i][2] = max(dp[i][2], abs(A[i]) + dp[i + 1][j]);
      }
    } else {
      dp[i][0] = -1e18;
      dp[i][1] = -1e18;
      dp[i][2] = -1e18;
      for (int j = 0; j < 3; j++) {
        if (j < 2) dp[i][0] = max(dp[i][0], -A[i] + dp[i + 1][j]);
        dp[i][1] = max(dp[i][1], A[i] + dp[i + 1][j]);
        dp[i][2] = max(dp[i][2], abs(A[i]) + dp[i + 1][j]);
      }
    }
  }
  printf("%lld", dp[1][0] + A[0]);
}
