#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:16000000")
#pragma warning(disable : 4996)
const int inf = 1 << 25;
const double eps = 1e-9;
struct Summand {
  int coef, inc;
  Summand() {}
  Summand(int c, int i) : coef(c), inc(i) {}
  int eval(int a) { return coef * (a + inc); }
  bool operator<(const Summand& X) const {
    if (coef < X.coef) return true;
    if (coef > X.coef) return false;
    return coef < 0 ? inc < X.inc : inc > X.inc;
  }
};
struct Parser {
  string s;
  int pos;
  Parser(const string& ss) : s(ss), pos(0) {}
  bool parsed() { return pos >= s.size(); }
  Summand nextSummand() {
    int sign = 1;
    if (s[pos++] == '-') sign = -1;
    int coef = 1;
    if (isdigit(s[pos])) coef = parseCoef();
    int inc = 0;
    if (s[pos] == '+') inc = 1;
    pos += 3;
    return Summand(sign * coef, inc);
  }

 private:
  int parseCoef() {
    int coef = 0;
    while (isdigit(s[pos++])) coef = coef * 10 + s[pos - 1] - '0';
    return coef;
  }
};
int main(int argc, char* argv[]) {
  int a;
  cin >> a;
  string s;
  cin >> s;
  s = string("+") + s;
  long long ans = 0;
  Parser P(s);
  vector<Summand> summands;
  while (!P.parsed()) summands.push_back(P.nextSummand());
  sort(summands.begin(), summands.end());
  for (int i = (0); i < ((int)summands.size()); ++i) {
    ans += summands[i].eval(a);
    ++a;
  }
  cout << ans << endl;
  return 0;
}
