#include <bits/stdc++.h>
using namespace std;
struct lexem {
  int cof;
  int suf;
  bool negative;
  bool cof_def;
  lexem() : cof(0), suf(0), negative(0), cof_def(0) {}
};
bool is_number(char c) { return c >= '0' && c <= '9'; }
vector<lexem> prs;
bool comp(lexem& a, lexem& b) { return a.cof < b.cof; }
int main() {
  ios_base::sync_with_stdio(false);
  long long a;
  cin >> a;
  string s;
  cin >> s;
  s.push_back('+');
  lexem cur;
  bool a_finded = false;
  bool exp_finded = false;
  for (int i = 0; i < s.length(); i++) {
    if (is_number(s[i])) {
      cur.cof = (cur.cof * 10) + (s[i] - '0');
      cur.cof_def = 1;
    } else if (s[i] == 'a') {
      a_finded = 1;
      if (!cur.cof_def) {
        cur.cof = 1;
        cur.cof_def = 1;
      }
    } else if (i + 1 < s.length() && s[i] == '+' && s[i + 1] == '+' &&
               !exp_finded) {
      cur.suf = (int)a_finded;
      i++;
      exp_finded = true;
    } else if (s[i] == '+' || s[i] == '-') {
      if (a_finded && exp_finded) {
        if (cur.negative) cur.cof *= -1;
        prs.push_back(cur);
        cur = lexem();
        a_finded = false;
        exp_finded = false;
        if (s[i] == '-') {
          cur.negative = 1;
        }
      }
    }
  }
  sort(prs.begin(), prs.end(), comp);
  long long sum = 0;
  for (int i = 0; i < prs.size(); i++) {
    sum += (prs[i].cof * (prs[i].suf ? a : a + 1));
    a++;
  }
  cout << sum;
  return 0;
}
