#include <bits/stdc++.h>
int Ans, BL, K[10100], B[10100], N, p[10100], A, n;
char s[10100];
bool cmp(int a, int b) { return K[a] < K[b]; }
int main() {
  int i, k;
  scanf("%d", &A);
  scanf("%s", s);
  n = strlen(s);
  if (s[0] != '+' && s[0] != '-') {
    for (i = n; i > 0; i--) s[i] = s[i - 1];
    s[0] = '+';
    n++;
    s[n] = 0;
  }
  for (k = 0; k < n;) {
    BL = s[k] == '-';
    if (s[k + 1] == '+') {
      K[N] = 1;
      k += 4;
      B[N] = 1;
    } else if (s[k + 1] == 'a') {
      K[N] = 1;
      k += 4;
      B[N] = 0;
    } else {
      for (i = k + 1; i < n; i++)
        if ('0' <= s[i] && s[i] <= '9')
          K[N] = K[N] * 10 + s[i] - '0';
        else
          break;
      k = i + 1;
      if (s[k] == '+')
        B[N] = 1;
      else
        B[N] = 0;
      k += 3;
    }
    if (BL) K[N] *= -1;
    N++;
  }
  for (i = 0; i < N; i++) p[i] = i;
  std::sort(p, p + N, cmp);
  for (i = 0; i < N; i++)
    if (B[p[i]] == 1)
      Ans += K[p[i]] * (++A);
    else
      Ans += K[p[i]] * (A++);
  printf("%d\n", Ans);
  return 0;
}
