#include <bits/stdc++.h>
using namespace std;
inline void Fail() {
  printf("0");
  exit(0);
}
const int maxn = 100005;
int n;
int a[maxn];
long long ans;
long long sum[maxn], sum2[maxn];
char c[2];
int main() {
  scanf("%d", &n);
  int op = 1;
  for (int(i) = 0; (i) < n; i++) {
    scanf("%d", &a[i]);
    a[i] *= op;
    if (i != n - 1) {
      scanf("%s", c);
      if (c[0] == '-')
        op = -1;
      else
        op = 1;
    }
  }
  for (int i = n - 1; i >= 0; i--) sum[i] = sum[i + 1] + abs(a[i]);
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] < 0)
      sum2[i] = 0;
    else
      sum2[i] = sum2[i + 1] + a[i];
  }
  long long cur = 0;
  for (int(i) = 0; (i) < n; i++) {
    cur += a[i];
    if (a[i] < 0) ans = max(ans, cur + sum[i + 1] - 2 * sum2[i + 1]);
  }
  printf("%lld", ans);
  return 0;
}
