#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
long long Mod(long long x) { return x >= mod ? x - mod : x; }
long long read() {
  long long x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
  return x * f;
}
void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
const int N = 100010;
long long ans, res;
long long a[N], pre[N], suf[N], tot;
int n, op[N];
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    tot += (a[i] = read());
    char ch = getchar();
    while (ch != '+' && ch != '-') ch = getchar();
    op[i] = (ch == '+') ? 1 : -1;
  }
  tot += (a[n] = read());
  for (int i = n; i; i--) {
    suf[i] = a[i];
    if (~op[i]) suf[i] += suf[i + 1];
  }
  for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a[i];
  res = a[1];
  ans = -4557430888798830399ll;
  for (int i = 2; i <= n; i++) {
    if (op[i - 1] == -1) ans = max(ans, res + pre[n] - pre[i - 1] - 2 * suf[i]);
    res += a[i] * op[i - 1];
  }
  print(ans), putchar('\n');
  return 0;
}
