#include <bits/stdc++.h>
using namespace std;
int a;
string expr;
vector<pair<int, bool> > summand;
int main() {
  char buffer[65536];
  scanf("%d%s", &a, buffer);
  expr = buffer;
  expr = "+" + expr;
  while (expr.size()) {
    bool flag = expr[(int)expr.size() - 1] == '+';
    expr.erase((int)expr.size() - 3);
    if (expr[(int)expr.size() - 1] == '*') {
      expr.erase((int)expr.size() - 1);
    }
    string coef;
    for (int pos = (int)expr.size() - 1; pos >= 0; pos--) {
      if (expr[pos] == '+' || expr[pos] == '-') {
        coef = expr.substr(pos);
        expr.erase(pos);
        break;
      }
    }
    if (coef[(int)coef.size() - 1] == '+' ||
        coef[(int)coef.size() - 1] == '-') {
      coef = coef + "1";
    }
    istringstream iss(coef);
    int value;
    iss >> value;
    summand.push_back(make_pair(value, flag));
  }
  sort(summand.begin(), summand.end());
  int res = 0;
  for (vector<pair<int, bool> >::const_iterator it = summand.begin();
       it != summand.end(); it++) {
    if (it->second) {
      res += it->first * (a++);
    } else {
      res += it->first * (++a);
    }
  }
  printf("%d\n", res);
  return 0;
}
