#include <bits/stdc++.h>
using namespace std;
char op[100005];
int n, mx;
long long a[100005], ans, dp[100005][2];
int main() {
  scanf("%d\n", &n);
  scanf("%lld ", &a[0]);
  for (int i = (1); i <= (n - 1); ++i) scanf("%c %lld ", &op[i], &a[i]);
  ans = -1e17;
  memset(dp, -0x7f, sizeof(dp));
  dp[0][0] = 0;
  for (int i = (1); i <= (n - 1); ++i) {
    if (op[i] == '+') {
      dp[i][1] = dp[i - 1][1] - a[i];
      dp[i][0] = max(dp[i - 1][0] + a[i], dp[i][1]);
    } else {
      dp[i][1] = max(dp[i - 1][1] + a[i], dp[i - 1][0] - a[i]);
      dp[i][0] = max(dp[i - 1][0] - a[i], dp[i][1]);
    }
  }
  ans = max(dp[n - 1][0], dp[n - 1][1]);
  printf("%lld\n", ans + a[0]);
  return 0;
}
