#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  std::vector<long long> val(1);
  std::cin >> val.front();
  bool prev = false;
  for (int i = 1; i < N; ++i) {
    char c;
    long long v;
    std::cin >> c >> v;
    if (c == '+') {
      if (prev) {
        val.emplace_back(v);
        prev = false;
      } else {
        val.back() += v;
      }
    } else {
      if (prev) {
        val.back() += v;
      } else {
        val.back() -= v;
        prev = true;
      }
    }
  }
  long long ret = val.front();
  for (int i = 1; i < val.size(); ++i) {
    auto v = val[i];
    if (v < 0) {
      ret -= v;
    } else {
      ret += v;
    }
  }
  std::cout << ret << std::endl;
}
