#include <bits/stdc++.h>
using namespace std;
const int maxn = 10001;
struct both {
  int x, y;
} A[maxn];
int num;
int n, ans, now, cheng, coe;
char st[maxn];
int cmp(both a, both b) { return a.x < b.x; }
int main() {
  int i;
  scanf("%d\n", &now);
  scanf("%s", st);
  num = 0;
  n = strlen(st);
  cheng = 1;
  for (i = 0; i < n; ++i) {
    if (st[i] == '+' && st[i + 1] == '+' && st[i + 2] == 'a')
      A[++num] = (both){cheng, 1}, cheng = 1, i += 2;
    else if (st[i] == 'a' && st[i + 1] == '+' && st[i + 2] == '+')
      A[++num] = (both){cheng, 0}, cheng = 1, i += 2;
    else if (st[i] == '+')
      continue;
    else if (st[i] == '-')
      cheng = -cheng;
    else if (st[i] == '*')
      cheng = cheng * coe, coe = 0;
    else
      coe = coe * 10 + st[i] - '0';
  }
  sort(A + 1, A + num + 1, cmp);
  for (i = 1; i <= num; ++i)
    if (A[i].y)
      ans += A[i].x * (++now);
    else
      ans += A[i].x * (now++);
  printf("%d", ans);
  return 0;
}
