#include <bits/stdc++.h>
using namespace std;
struct Node {
  int incr, cof;
};
const int MAXN = 1005;
const int MAXLEN = 10000;
string st;
Node a[MAXN];
bool comp(Node a, Node b) { return a.cof < b.cof; }
int main() {
  int n;
  int num;
  int ans;
  string p = "+";
  cin >> num;
  cin >> st;
  st = p + st;
  n = 0;
  while (st != "") {
    string cof;
    int neg = 1;
    if (st[0] == '-') neg = -1;
    st = st.substr(1);
    int pos = st.find("++");
    if (st[pos - 1] == 'a') {
      cof = st.substr(0, pos - 1);
      a[n].incr = 0;
      st = st.substr(pos + 2);
    } else {
      cof = st.substr(0, pos);
      a[n].incr = 1;
      st = st.substr(pos + 3);
    }
    if (cof == "")
      a[n].cof = 1;
    else {
      stringstream ss;
      ss << cof;
      ss >> a[n].cof;
    }
    a[n].cof *= neg;
    n++;
  }
  sort(a, a + n, comp);
  ans = 0;
  for (int i = 0; i < n; i++)
    if (a[i].incr == 0)
      ans += (num++) * a[i].cof;
    else
      ans += (++num) * a[i].cof;
  cout << ans << endl;
  return 0;
}
