#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 101 * 1001, MOD = 1e9 + 7, sq = 333;
long long a[MAXN];
char ch[MAXN];
long long dp[MAXN][2];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, s = 0, ind = -1, cnt = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    if (i) cin >> ch[i];
    cin >> a[i];
    s += a[i];
    if (ch[i] == '-' && ind == -1) ind = i;
    if (i && ch[i] == '-') a[i] *= -1, cnt++;
  }
  if (ind == -1) return cout << s, 0;
  if (cnt == 1) return cout << s + 2 * a[ind], 0;
  ind++;
  s += 2 * a[ind - 1];
  while (ch[ind] != '-') s -= 2 * a[ind++];
  return cout << s, 0;
  dp[n - 1][0] = a[n - 1];
  dp[n - 1][1] = abs(a[n - 1]);
  for (long long i = n - 2; i; i--) {
    dp[i][0] = a[i] + dp[i + 1][0];
    if (a[i] < 0) dp[i][0] = max(dp[i][0], a[i] + dp[i + 1][1]);
    dp[i][1] = dp[i][0];
    dp[i][1] = max(dp[i][1], -a[i] + dp[i + 1][1]);
    if (a[i] < 0) dp[i][1] = max(dp[i][1], -a[i] + dp[i + 1][0]);
    cout << i << ' ' << dp[i][0] << ' ' << dp[i][1] << ' ' << a[i] << '\n';
  }
  if (n == 1) return cout << a[0], 0;
  cout << a[0] + dp[1][0];
}
