#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chkmin(T& a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool chkmax(T& a, T b) {
  return a < b ? a = b, true : false;
}
template <class T>
void read(T& a) {
  char c = getchar();
  T f = 1;
  a = 0;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) a = a * 10 + c - '0';
  a *= f;
}
template <class T>
void write(T a) {
  static int stk[60];
  int tp = 0;
  if (a < 0) putchar('-'), a = -a;
  do {
    stk[++tp] = a % 10;
    a /= 10;
  } while (a);
  while (tp) putchar(stk[tp--] + '0');
}
const int maxN = 1e5 + 5;
int a[maxN];
char b[maxN];
int N;
long long cnt = 0;
int main() {
  cin >> N;
  read(a[1]);
  long long ans = a[1];
  long long sum = a[1];
  for (int i = (2), _ = (N); i <= _; ++i) {
    char& c = b[i] = getchar();
    while (c != '-' && c != '+') c = getchar();
    read(a[i]);
    if (c == '-')
      cnt += a[i], ans -= a[i];
    else
      ans += a[i];
    sum += a[i];
  }
  long long sora = 0;
  for (int i = (N), _ = (2); i >= _; --i) {
    sora += a[i];
    if (b[i] == '-') {
      cnt -= a[i];
      chkmax(ans, sum - 2 * sora - cnt);
      sora = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
