#include <bits/stdc++.h>
using namespace std;
int p, n, m, x[10005], ans;
char c[10005], *s;
void Init() {
  scanf("%d", &p);
  scanf("%s", c + 1);
  if (c[1] == '-')
    s = c + 1;
  else {
    c[0] = '+';
    s = c;
  }
  n = strlen(s);
  int d, t;
  for (int i = 0; i <= n - 1; ++i) {
    if (s[i] == '+')
      d = 1;
    else
      d = -1;
    ++i;
    if (s[i] == '+')
      ans += d, x[++m] = d;
    else if (s[i] == 'a')
      x[++m] = d;
    else {
      t = 0;
      while (s[i] != '*') {
        t = t * 10 + (s[i] - 48) * d;
        ++i;
      }
      ++i;
      if (s[i] == '+')
        ans += t, x[++m] = t;
      else if (s[i] == 'a')
        x[++m] = t;
    }
    i += 2;
  }
}
void Work() {
  sort(x + 1, x + 1 + m);
  for (int i = 1; i <= m; ++i) {
    ans += x[i] * p;
    ++p;
  }
  printf("%d\n", ans);
}
int main() {
  Init();
  Work();
  return 0;
}
