#include <bits/stdc++.h>
using namespace std;
const int S = (1 << 20) + 5;
char buf[S], *H, *T;
inline char Get() {
  if (H == T) T = (H = buf) + fread(buf, 1, S, stdin);
  if (H == T) return -1;
  return *H++;
}
inline int read() {
  int x = 0;
  char c = Get();
  while (!isdigit(c)) c = Get();
  while (isdigit(c)) x = x * 10 + c - '0', c = Get();
  return x;
}
inline int readopt() {
  char c = Get();
  while (c != '+' && c != '-') c = Get();
  return c;
}
const int N = 100010;
int num[N], n, k;
char opt[N];
long long f[2][3];
int main() {
  n = read();
  num[0] = read();
  for (int i = 1; i < n; i++) {
    opt[i] = readopt();
    num[i] = read();
  }
  f[k = 0][0] = num[0];
  f[0][1] = f[0][2] = -(1ll << 60);
  for (int i = 1; i < n; i++, k ^= 1) {
    if (opt[i] == '+') {
      f[k ^ 1][0] = max(max(f[k][0], f[k][1]), f[k][2]) + num[i];
      f[k ^ 1][1] = max(f[k][1], f[k][2]) - num[i];
      f[k ^ 1][2] = f[k][2] + num[i];
    } else {
      f[k ^ 1][0] = max(max(f[k][0], f[k][1]), f[k][2]) - num[i];
      f[k ^ 1][1] = max(max(f[k][1], f[k][2]) + num[i], f[k][0] - num[i]);
      f[k ^ 1][2] = max(f[k][2] - num[i], f[k][1] + num[i]);
    }
  }
  int ans = max(max(f[k][0], f[k][1]), f[k][2]);
  printf("%d\n", ans);
  return 0;
}
