#include <bits/stdc++.h>
using namespace std;
struct node {
  int co, key;
} num[1010];
int seven;
char str[1010 * 100];
int init;
bool cmp(node x, node y) { return x.co < y.co; }
int main() {
  scanf("%d", &init);
  scanf("%s", str);
  seven = 1;
  int cnt = 1;
  int length = strlen(str);
  int now = 0;
  int pre = -1;
  for (int i = 1; i <= 1000; i++) num[i].co = 1;
  while (now < length) {
    if (str[now] == '-') {
      seven = -1;
      now++;
    } else if (str[now] == '*' || str[now] == '+')
      now++;
    else if (str[now] == 'a') {
      if (now - 2 > pre && str[now - 1] == '+' && str[now - 2] == '+') {
        pre = now;
        num[cnt].co *= seven;
        num[cnt].key = 0;
        cnt++;
        now++;
      } else {
        pre = now + 2;
        num[cnt].co *= seven;
        num[cnt].key = 1;
        cnt++;
        now += 3;
      }
      seven = 1;
    } else {
      int sum = 0;
      while (str[now] >= '0' && str[now] <= '9') {
        sum = sum * 10 + (str[now] - '0');
        now++;
      }
      num[cnt].co = sum;
    }
  }
  cnt--;
  sort(num + 1, num + 1 + cnt, cmp);
  int ans = 0;
  for (int i = 1; i <= cnt; i++) {
    if (!num[i].key) {
      init++;
      ans += (num[i].co * init);
    } else {
      ans += (num[i].co * init);
      init++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
