#include <bits/stdc++.h>
using namespace std;
struct sum {
  int x, v;
} b[1010];
int a, k, ans;
string s;
bool cmp(sum x, sum y) { return x.v < y.v; }
int main() {
  cin >> a >> s;
  s = "+" + s;
  for (int i = 0; i < s.size(); i += 3) {
    bool f = false;
    int x = 0;
    if (s[i] == '+') {
      f = true;
    }
    i++;
    if (s[i] >= '0' && s[i] <= '9') {
      while (s[i] >= '0' && s[i] <= '9') {
        x = x * 10 + s[i] - '0';
        i++;
      }
      i++;
    } else {
      x = 1;
    }
    if (s[i] == '+') {
      b[k].x = 1;
    }
    if (f) {
      b[k].v = x;
    } else {
      b[k].v = -x;
    }
    k++;
  }
  sort(b, b + k, cmp);
  for (int i = 0; i < k; i++) {
    if (b[i].x) {
      ans += b[i].v * (++a);
    } else {
      ans += b[i].v * (a++);
    }
  }
  cout << ans << endl;
  return 0;
}
