#include <bits/stdc++.h>
using namespace std;
char s[100005];
struct node {
  int x, op;
} a[100005];
bool cmp(node q, node w) { return q.x < w.x; }
int cnt;
bool vis[100005];
int main() {
  int now, len, i;
  scanf("%d", &now);
  scanf("%s", s + 1);
  len = strlen(s + 1);
  s[0] = '+';
  for (i = 1; i <= len; i++) {
    if (s[i] == 'a') {
      cnt++;
      vis[i] = 1;
      if (i > 2 && s[i - 1] == '+' && s[i - 2] == '+' && !vis[i - 1] &&
          !vis[i - 2]) {
        a[cnt].op = 1;
        vis[i - 1] = 1;
        vis[i - 2] = 1;
        if (s[i - 3] == '+')
          a[cnt].x = 1;
        else if (s[i - 3] == '-')
          a[cnt].x = -1;
        else if (s[i - 3] == '*') {
          a[cnt].x = 0;
          int j, flg = 1;
          for (j = i - 4; j >= 1; j--)
            if (s[j] < '0' || s[j] > '9') {
              if (s[j] == '-') flg = -1;
              break;
            }
          for (j++; j <= i - 4; j++) a[cnt].x = 10 * a[cnt].x + s[j] - 48;
          a[cnt].x *= flg;
        }
      } else if (s[i + 1] == '+' && s[i + 2] == '+' && !vis[i + 1] &&
                 !vis[i + 2]) {
        a[cnt].op = 0;
        vis[i + 1] = 1;
        vis[i + 2] = 1;
        if (s[i - 1] == '+')
          a[cnt].x = 1;
        else if (s[i - 1] == '-')
          a[cnt].x = -1;
        else if (s[i - 1] == '*') {
          a[cnt].x = 0;
          int j, flg = 1;
          for (j = i - 2; j >= 1; j--)
            if (s[j] < '0' || s[j] > '9') {
              if (s[j] == '-') flg = -1;
              break;
            }
          for (j++; j <= i - 2; j++) a[cnt].x = 10 * a[cnt].x + s[j] - 48;
          a[cnt].x *= flg;
        }
      }
    }
  }
  sort(a + 1, a + cnt + 1, cmp);
  long long ans = 0;
  for (i = 1; i <= cnt; i++) {
    if (a[i].op == 1) {
      now++;
      ans = 1ll * ans + 1ll * now * a[i].x;
    } else {
      ans = 1ll * ans + 1ll * now * a[i].x;
      now++;
    }
  }
  printf("%I64d", ans);
}
