#include <bits/stdc++.h>
using namespace std;
int a, ans, cnt, len;
char ch[1000005];
struct node {
  int k, id;
} q[1000005];
bool num(int a) { return '0' <= a && a <= '9'; }
bool cmp(node a, node b) { return a.k == b.k ? a.id < b.id : a.k < b.k; }
int main() {
  scanf("%d%s", &a, ch + 1);
  len = strlen(ch + 1);
  for (int i = 1; i <= len; i++) {
    if (ch[i] == 'a') {
      if (i == 1 || ch[i - 1] == '+') q[++cnt] = (node){1, 1};
      if (ch[i - 1] == '-') q[++cnt] = (node){-1, 1};
      i += 3;
      continue;
    }
    if (ch[i] == '+') {
      if (i == 1 || ch[i - 1] == '+') q[++cnt] = (node){1, 0};
      if (ch[i - 1] == '-') q[++cnt] = (node){-1, 0};
      i += 3;
      continue;
    }
    if (num(ch[i])) {
      int n = 0, be = i;
      while (num(ch[i])) n = n * 10 + ch[i] - '0', i++;
      i++;
      if (ch[i] == 'a') {
        if (be == 1 || ch[be - 1] == '+') q[++cnt] = (node){n, 1};
        if (ch[be - 1] == '-') q[++cnt] = (node){-n, 1};
        i += 3;
        continue;
      }
      if (ch[i] == '+') {
        if (be == 1 || ch[be - 1] == '+') q[++cnt] = (node){n, 0};
        if (ch[be - 1] == '-') q[++cnt] = (node){-n, 0};
        i += 3;
        continue;
      }
    }
  }
  sort(q + 1, q + 1 + cnt, cmp);
  for (int i = 1; i <= cnt; i++) {
    if (q[i].id == 1)
      ans += q[i].k * (a++);
    else
      ans += q[i].k * (++a);
  }
  printf("%d\n", ans);
}
