#include <bits/stdc++.h>
using namespace std;
struct Topp {
  int coef;
  bool before;
  Topp(int c, bool b) : coef(c), before(b) {}
  bool operator<(const Topp &s) const { return coef < s.coef; }
};
int main() {
  int a;
  vector<Topp> summands;
  string str;
  streampos last_pos;
  cin >> a >> str;
  stringstream iss;
  if (str[0] != '-') iss << '+';
  iss << str;
  int coef;
  char sgn, ch;
  while (iss.good()) {
    iss >> sgn;
    last_pos = iss.tellg();
    if (iss >> coef) {
      iss >> ch;
    } else {
      iss.clear();
      iss.seekg(last_pos);
      coef = 1;
    }
    if (iss >> ch) {
      coef = sgn == '-' ? -coef : coef;
      summands.push_back(Topp(coef, ch == '+'));
      iss >> ch >> ch;
    }
  }
  sort(summands.begin(), summands.end());
  int sum = 0;
  for (int i = 0; i < summands.size(); i++)
    sum += summands[i].coef * (summands[i].before ? ++a : a++);
  cout << sum;
  return 0;
}
