#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 10;
const long long mod = 1e9 + 7;
long long cnt[maxn];
int32_t main() {
  long long n;
  cin >> n;
  long long l = 0;
  long long sum = 0;
  bool can = false;
  for (long long i = 0; i < 2 * n - 1; i++) {
    if (i % 2) {
      char ch;
      cin >> ch;
      if (ch == '+') {
        can = false;
        l = 0;
      } else {
        if (l == 1)
          can = true;
        else
          can = false;
        l = 1;
      }
    } else {
      long long a;
      cin >> a;
      if (l == 0 || can) {
        sum += a;
      } else
        sum -= a;
    }
  }
  cout << sum << endl;
}
