#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<long long int> A(1);
  scanf("%lld", &A[0]);
  for (int i = 1; i < n; ++i) {
    char op;
    long long int val;
    scanf(" %c %lld", &op, &val);
    if (op == '+')
      A[A.size() - 1] += val;
    else
      A.push_back(val);
  }
  long long int ans = A[0], temp = 0;
  if (A.size() > 1) {
    temp = A[1];
    for (int i = 2; i < A.size(); ++i) {
      temp -= A[i];
    }
  }
  printf("%lld\n", ans - temp);
  return 0;
}
