#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int cnt = 0;
  ll ans;
  cin >> ans;
  for (int i = 1; i < n; i++) {
    char op;
    int a;
    cin >> op >> a;
    if (op == '-') cnt++;
    if (cnt % 2 == 0)
      ans += a;
    else
      ans -= a;
  }
  cout << ans << endl;
  return 0;
}
