#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline int getint() {
  int w = 0, q = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 1, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? -w : w;
}
int n;
long long a[100005];
char c[100005];
int main() {
  n = getint();
  int i = 0;
  long long ans = 0;
  long long sum = 0;
  while (i < n) {
    a[i] = getint();
    sum += a[i];
    if (i != 0 && c[i - 1] == '-') {
      ans -= a[i];
    } else {
      ans += a[i];
    }
    if (i == n - 1) {
      break;
    }
    c[i] = getchar();
    i++;
  }
  int flag = 1;
  for (int i = 0; i < n; i++) {
    if (c[i] == '-') {
      sum -= a[i + 1] * 2;
      int j = i + 1;
      while (j < n) {
        if (c[j] == '+') {
          sum -= a[j + 1] * 2;
          j++;
        } else {
          break;
        }
      }
      break;
    }
  }
  ans = max(sum, ans);
  cout << ans << endl;
  return 0;
}
