#include <bits/stdc++.h>
using namespace std;
struct ll {
  int num, flg;
} Q[1006];
char str[10000];
bool cmp(ll a, ll b) {
  int x = a.num, y = b.num;
  if (a.flg == 1 && b.flg == 1) return y > x;
  return y > x;
}
int main() {
  int st;
  scanf("%d", &st);
  scanf("%s", str + 1);
  int n = strlen(str + 1), flg = 1, len = 0;
  for (int i = 1; i <= n; i++) {
    if (str[i] >= '0' && str[i] <= '9') {
      int num = 0;
      while (str[i] >= '0' && str[i] <= '9')
        num = (num << 3) + (num << 1) + (str[i] ^ 48), i++;
      i++;
      num *= flg;
      Q[++len].num = num;
      if (str[i] == '+')
        Q[len].flg = 1;
      else
        Q[len].flg = 2;
      i += 2;
      flg = 0;
    } else {
      if (flg == 0) {
        if (str[i] == '+')
          flg = 1;
        else
          flg = -1;
        continue;
      } else {
        Q[++len].num = flg;
        if (str[i] == 'a')
          Q[len].flg = 2;
        else
          Q[len].flg = 1;
        flg = 0, i += 2;
      }
    }
  }
  sort(Q + 1, Q + len + 1, cmp);
  int ans = 0;
  for (int i = 1; i <= len; i++) {
    ans = ans + Q[i].num * ((Q[i].flg & 1) + st);
    st++;
  }
  printf("%d\n", ans);
  return 0;
}
