#include <bits/stdc++.h>
using namespace std;
const long long inf = 1LL << 60;
long long a[100010], n, cnt = 0, num = 0, f[100010][2];
char s[20];
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    if (i != 1) {
      scanf("%s", s + 1);
      if (s[1] == '-') a[++cnt] = num, num = 0;
    }
    scanf("%s", s + 1);
    long long len, tmp = 0;
    len = strlen(s + 1);
    for (long long i = 1; i <= len; i++) tmp = tmp * 10 + s[i] - '0';
    num += tmp;
  }
  a[++cnt] = num;
  long long ans = a[1];
  if (cnt > 1) ans -= a[2];
  for (int i = 3; i <= cnt; i++) ans += a[i];
  printf("%lld", ans);
}
