#include <bits/stdc++.h>
using namespace std;
int n, a[100010], ty;
long long F, G;
char op[100010];
void work() {
  scanf("%d %d", &n, &a[1]);
  for (int i = 2; i <= n; i++) {
    do op[i] = getchar();
    while ((op[i] != '+') && (op[i] != '-'));
    scanf("%d", &a[i]);
  }
  F = G = a[1], ty = 0;
  for (int i = 2; i <= n; i++)
    if (op[i] == '+') {
      if (ty)
        F -= a[i], G += a[i];
      else
        F += a[i], G -= a[i];
      G = max(F, G);
    } else {
      if (ty)
        F += a[i], G -= a[i];
      else
        F -= a[i], G += a[i];
      G = max(F, G), ty ^= 1;
    }
  printf("%lld\n", G);
}
int main() {
  work();
  return 0;
}
