#include <bits/stdc++.h>
using namespace std;
int a, ct, sv, r, fp, fn, ans;
char s[100001];
vector<pair<int, int> > pos, neg;
int main() {
  scanf("%d", &a);
  ct = 1;
  scanf("%s", s);
  for (int i = 0; s[i] != 0; i++) {
    if (s[i] == '-') {
      sv = -1;
    } else if (s[i] == '+') {
      if (s[i + 1] == '+' && s[i + 2] == 'a') {
        if (sv == -1)
          neg.push_back(pair<int, int>(ct, 1));
        else
          pos.push_back(pair<int, int>(ct, 1));
        ct = 1;
        sv = 0;
        i += 2;
      } else
        sv = 1;
    } else if (s[i] == 'a') {
      if (sv == -1)
        neg.push_back(pair<int, int>(ct, 2));
      else
        pos.push_back(pair<int, int>(ct, 2));
      ct = 1;
      sv = 0;
      i += 2;
    } else if (s[i] == '*') {
    } else if (s[i] >= '0' && s[i] <= '9') {
      ct = 0;
      for (; s[i] != 0 && s[i] >= '0' && s[i] <= '9'; i++)
        ct *= 10, ct += s[i] - '0';
      i--;
    }
  }
  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end());
  r = pos.size() + neg.size();
  while (r) {
    if (neg.size() > fn) {
      ans -= neg.back().first * (a + (neg.back().second == 1 ? 1 : 0));
      a++;
      neg.pop_back();
    } else {
      ans += pos[fp].first * (a + (pos[fp].second == 1 ? 1 : 0));
      a++;
      fp++;
    }
    r--;
  }
  printf("%d\n", ans);
  return 0;
}
