#include <bits/stdc++.h>
const double pi = acos(-1.0), eps = 1e-9;
const int dx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1};
const int MO = (int)(1e9 + 7);
using namespace std;
int a, ans;
string s;
vector<pair<int, int> > t;
int getnum() {
  if (!isdigit(s[0])) return 1;
  int ret = 0;
  while (isdigit(s[0])) {
    ret = ret * 10 + s[0] - '0';
    s.erase(s.begin());
  }
  return ret;
}
int main() {
  cin >> a >> s;
  while (s.size()) {
    int t = s.find('a');
    if (t >= 2 && s[t - 1] == '+' && s[t - 2] == '+') {
      int t = 1;
      if (s[0] == '-') t = -1;
      if (s[0] == '-' || s[0] == '+') s.erase(s.begin());
      ::t.push_back(make_pair(getnum() * t, 1));
      while (s[0] != 'a') s.erase(s.begin());
      s.erase(s.begin());
    } else {
      int t = 1;
      if (s[0] == '-') t = -1;
      if (s[0] == '-' || s[0] == '+') s.erase(s.begin());
      ::t.push_back(make_pair(getnum() * t, 2));
      while (s[0] != 'a') s.erase(s.begin());
      s.erase(s.begin());
      s.erase(s.begin());
      s.erase(s.begin());
    }
  }
  sort(t.begin(), t.end());
  for (int i = 0; i < t.size(); i++)
    if (t[i].second == 2)
      ans += t[i].first * (a++);
    else
      ans += t[i].first * (++a);
  cout << ans << endl;
}
