#include <bits/stdc++.h>
using namespace std;
vector<pair<int, bool> > ps;
string s;
int a, coef, sign;
bool post;
bool IsDig(char c) { return (c >= '0' && c <= '9'); }
int StrToInt(string s) {
  int res;
  sscanf(s.c_str(), "%d", &res);
  return res;
}
bool operator<(pair<int, bool> p1, pair<int, bool> p2) {
  return (p1.first < p2.first ||
          p1.first == p2.first && (p1.first < 0 && p1.second));
}
int main() {
  scanf("%d", &a);
  cin >> s;
  s = '+' + s;
  int i = 0, j;
  while (i < s.length()) {
    if (s[i] == '+')
      sign = 1;
    else
      sign = -1;
    i++;
    if (IsDig(s[i])) {
      j = i;
      while (IsDig(s[j++]))
        ;
      coef = StrToInt(s.substr(i, j - i));
      i = j;
    } else
      coef = 1;
    post = !(s[i] == '+');
    i += 3;
    coef *= sign;
    ps.push_back(make_pair(coef, post));
  }
  sort(ps.begin(), ps.end());
  int sum = 0;
  for (int i = 0; i < ps.size(); i++) {
    sum += ps[i].first * (ps[i].second ? a++ : ++a);
  }
  cout << sum;
  return 0;
}
