#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long dp[maxn][2];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 2; j++) dp[i][j] = -100000000000000000LL;
  }
  int x;
  scanf("%d", &x);
  dp[1][0] = x;
  for (int i = 2; i <= n; i++) {
    int num;
    char s[3];
    scanf("%s%d", s, &num);
    if (s[0] == '-') {
      dp[i][0] = max(dp[i - 1][0] - num, dp[i - 1][1] + num);
      dp[i][1] = max(dp[i - 1][0] - num, dp[i - 1][1] + num);
    } else {
      dp[i][0] = max(dp[i - 1][0] + num, dp[i - 1][1] - num);
      dp[i][1] = max(dp[i - 1][0] + num, dp[i - 1][1] - num);
    }
  }
  printf("%lld\n", max(dp[n][0], dp[n][1]));
  return 0;
}
