#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
char str[N];
struct node {
  int flag;
  long long val;
};
struct node ans[N];
bool cmp(const node x, const node y) { return x.val < y.val; }
int main() {
  int a0;
  scanf("%d%s", &a0, str + 1);
  str[0] = '+';
  int n = strlen(str);
  int size = 0;
  for (int i = 0; i < n; i += 3) {
    int f;
    if ('+' == str[i])
      f = 1;
    else
      f = -1;
    i++;
    long long t = 0;
    if (str[i] >= '0' && str[i] <= '9') {
      while (i <= n && str[i] >= '0' && str[i] <= '9') {
        t = t * 10 + str[i] - '0';
        i++;
      }
    } else
      t = 1;
    if ('*' == str[i]) i++;
    if ('a' == str[i])
      ans[size].flag = 0;
    else
      ans[size].flag = 1;
    ans[size++].val = t * f;
  }
  sort(ans, ans + size, cmp);
  long long ret = 0;
  for (int i = 0; i < size; i++) {
    if (ans[i].flag)
      ret += ans[i].val * (a0 + 1);
    else
      ret += ans[i].val * a0;
    a0++;
  }
  printf("%I64d\n", ret);
  return 0;
}
