#include <bits/stdc++.h>
using namespace std;
int N;
long long a[200005], s[200005];
int main() {
  cin >> N;
  cin >> a[1];
  int N1 = 1;
  char op;
  int x;
  for (int i = 1; i < N; i++) {
    cin >> op;
    cin >> x;
    if (op == '+')
      a[N1] += x;
    else
      a[++N1] = x;
  }
  N = N1;
  if (N == 1) {
    cout << a[1] << endl;
    return 0;
  }
  for (int i = 1; i <= N; i++) {
    s[i] = s[i - 1] + a[i];
  }
  long long ans = a[1] - (2 <= N ? (s[N] - s[2 - 1]) : 0);
  ans = a[1] - a[2] + (3 <= N ? (s[N] - s[3 - 1]) : 0);
  cout << ans << endl;
  return 0;
}
