#include <bits/stdc++.h>
using namespace std;
vector<pair<int, bool> > vp;
int main() {
  int a, out = 0;
  cin >> a;
  string rs, ps;
  cin >> rs;
  for (int i = 0; i < rs.size(); i++)
    if (rs[i] == '+' && rs[i + 1] == '+' && rs[i + 2] == 'a')
      ps += 'i', i += 2;
    else if (rs[i] == 'a' && rs[i + 1] == '+' && rs[i + 2] == '+')
      ps += 'j', i += 2;
    else if (rs[i] != '*')
      ps += rs[i];
  int cof = 0;
  int sgn = 1;
  for (int i = 0; i < ps.size(); i++) {
    char c = ps[i];
    if (c == '-')
      sgn = -1, cof = 0;
    else if (c == '+')
      sgn = +1, cof = 0;
    else if (isdigit(c))
      cof = cof * 10 + (c - '0');
    else if (c == 'i' || c == 'j') {
      if (!i || ps[i - 1] == '+' || ps[i - 1] == '-') cof = 1;
      vp.push_back(pair<int, bool>(sgn * cof, c - 'i'));
    }
  }
  sort(vp.begin(), vp.end());
  for (int i = 0; i < vp.size(); i++)
    if (!vp[i].second)
      out += vp[i].first * (++a);
    else
      out += vp[i].first * (a++);
  cout << out << endl;
  return 0;
}
