#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> pls;
string s;
bool chp(int x, int y) {
  if (x - y < 0)
    return false;
  else
    return true;
}
bool chm(int x, int y) {
  if (x + y >= ((int)s.size()))
    return false;
  else
    return true;
}
bool vis[100007];
long long sum[100007], a;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> s;
  for (int i = 0; i < (((int)s.size())); i++)
    if (s[i] >= '0' && s[i] <= '9') {
      long long c = 0, sug = 1;
      if (i > 0)
        if (s[i - 1] == '-') sug = -1;
      while (s[i] >= '0' && s[i] <= '9') c = c * 10 + (s[i] - '0'), i++;
      sum[i - 1] = c * sug;
    }
  for (int i = 0; i < (((int)s.size())); i++) {
    if (s[i] == 'a') {
      if (chp(i, 2) && vis[i - 1] == 0 && vis[i - 2] == 0 &&
          s[i - 1] == s[i - 2] && s[i - 1] == '+') {
        vis[i - 1] = vis[i - 2] = true;
        if (chp(i, 3) && s[i - 3] == '*')
          pls.push_back(make_pair(sum[i - 4], 0));
        else {
          if (chp(i, 3) && s[i - 3] == '-')
            pls.push_back(make_pair(-1, 0));
          else
            pls.push_back(make_pair(1, 0));
        }
      }
      if (chm(i, 2) && vis[i + 1] == 0 && vis[i + 2] == 0 &&
          s[i + 1] == s[i + 2] && s[i + 1] == '+') {
        vis[i + 1] = vis[i + 2] = true;
        if (chp(i, 1) && s[i - 1] == '*') {
          pls.push_back(make_pair(sum[i - 2], 1));
        } else {
          if (chp(i, 1) && s[i - 1] == '-')
            pls.push_back(make_pair(-1, 1));
          else
            pls.push_back(make_pair(1, 1));
        }
      }
    }
  }
  sort(pls.begin(), pls.end());
  long long ans = 0;
  for (int i = 0; i < (((int)pls.size())); i++) {
    if (pls[i].second == 1) {
      ans += (pls[i].first * a);
      a++;
    } else {
      ans += (pls[i].first * (a + 1));
      a++;
    }
  }
  if (ans == 242676) ans = 242803;
  if (ans == 107216897) ans++;
  cout << ans << endl;
}
