#include <bits/stdc++.h>
using namespace std;
long long a;
char s[1000003];
struct node {
  long long xs, flag, zh;
  int num;
} b[1000003];
int cnt;
bool f[1000003];
queue<char> q;
bool cmp(node a, node b) { return a.num < b.num; }
bool cmp2(node a, node b) { return a.xs < b.xs; }
int main() {
  scanf("%I64d", &a);
  scanf("%s", s);
  int len = strlen(s);
  bool fla = 0;
  for (int i = 0; i < len; i++) {
    if (s[i] == 'a') {
      f[i] = 1;
      cnt++;
      b[cnt].num = i;
      b[cnt].xs = 1;
      if (i > 1 && s[i - 1] == '+' && s[i - 2] == '+' && !f[i - 1] &&
          f[i - 2] == 0) {
        f[i - 1] = f[i - 2] = 1;
        if (i > 3 && s[i - 3] == '*') {
          b[cnt].xs = 0;
          int j = i;
          i -= 4;
          while (i >= 0 && s[i] >= '0' && s[i] <= '9') {
            i--;
          }
          i++;
          while (i <= j - 4) {
            f[i] = 1;
            b[cnt].xs = b[cnt].xs * 10 + s[i] - '0';
            i++;
          }
          i = j;
        }
        b[cnt].flag = 1;
      } else {
        f[i + 1] = f[i + 2] = 1;
        if (s[i - 1] == '*') {
          b[cnt].xs = 0;
          int j = i;
          i -= 2;
          while (i >= 0 && s[i] >= '0' && s[i] <= '9') {
            i--;
          }
          i++;
          while (i <= j - 2) {
            f[i] = 1;
            b[cnt].xs = b[cnt].xs * 10 + s[i] - '0';
            i++;
          }
          i = j;
        }
        b[cnt].flag = 0;
      }
    }
  }
  for (int i = 0; i < len; i++) {
    if (f[i] == 0 && (s[i] == '+' || s[i] == '-')) {
      q.push(s[i]);
    } else if (f[i] == 0 && s[i] >= '0' && s[i] <= '9') {
      cnt++;
      b[cnt].flag = 2;
      b[cnt].num = i;
      while (i < len && s[i] >= '0' && s[i] <= '9') {
        b[cnt].xs = b[cnt].xs * 10 + s[i] - '0';
        i++;
      }
      i--;
    }
  }
  sort(b + 1, b + cnt + 1, cmp);
  if (q.size() == cnt) {
    if (q.front() == '-') b[1].xs *= -1ll;
    q.pop();
  }
  for (int i = 2; i <= cnt; i++) {
    if (q.front() == '-') b[i].xs *= -1ll;
    q.pop();
  }
  sort(b + 1, b + cnt + 1, cmp2);
  long long ans = 0;
  for (int i = 1; i <= cnt; i++) {
    if (b[i].flag == 2) {
      ans += b[i].xs;
      continue;
    }
    if (b[i].flag) {
      a++;
      b[i].zh = b[i].xs * a;
    } else {
      b[i].zh = b[i].xs * a;
      a++;
    }
    ans += b[i].zh;
  }
  printf("%I64d", ans);
  return 0;
}
