#include <bits/stdc++.h>
using namespace std;
const long long maxn = 10005;
long long n, tot;
char ch[maxn];
struct node {
  long long val, xi;
  bool operator<(const node &a) const { return val < a.val; }
} num[maxn];
long long read() {
  char x = getchar();
  long long a = 0, k = 1;
  while (!isdigit(x) && x != '-') x = getchar();
  if (x == '-')
    k = -1;
  else
    a = x - '0';
  x = getchar();
  while (isdigit(x)) a = (a << 3) + (a << 1) + x - '0', x = getchar();
  return a * k;
}
signed main() {
  long long a = read(), flag;
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  for (long long i = 1; i <= n; i++) {
    flag = 1;
    if (ch[i] == '-') flag = -1, i++;
    if (ch[i] == '+' &&
        (ch[i + 1] != '+' || (ch[i + 1] == '+' && ch[i + 2] == '+')))
      i++;
    if (isdigit(ch[i])) {
      tot++;
      while (isdigit(ch[i])) {
        num[tot].val = (num[tot].val << 3) + (num[tot].val << 1) + ch[i] - '0';
        i++;
      }
      i++;
      num[tot].val *= flag;
      if (ch[i] == '+') num[tot].xi = 1;
      i += 2;
    } else if (ch[i] == '+' || ch[i] == 'a') {
      num[++tot].val = flag;
      if (ch[i] == '+') num[tot].xi = 1;
      i += 2;
    }
  }
  std::sort(num + 1, num + tot + 1);
  long long ans = 0;
  for (long long i = 1; i <= tot; i++)
    ans += num[i].val * (num[i].xi ? a + 1 : a), a++;
  printf("%lld\n", ans);
  return 0;
}
