#include <bits/stdc++.h>
using namespace std;
int tot, n;
char s[100008];
struct arr {
  int v, f;
  bool operator<(const arr &t) const { return v < t.v; }
} a[100008];
struct Tprogram {
  void open() {
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
  }
  void close() {}
  int get(int &p) {
    int sign = 1;
    if (s[p] == '-') sign = -1;
    p++;
    if (s[p] < '0' || s[p] > '9') return sign;
    int cnt = 0;
    while (s[p] <= '9' && s[p] >= '0') {
      cnt = cnt * 10 + s[p] - '0';
      p++;
    }
    p++;
    return cnt * sign;
  }
  void init() {
    scanf("%d", &n);
    scanf("%s", &s[1]);
    int m = strlen(&s[1]), p = 1;
    if (s[1] != '-') {
      for (int i = m + 1; i >= 2; i--) s[i] = s[i - 1];
      s[1] = '+';
    }
    while (p <= m) {
      a[++tot].v = get(p);
      if (s[p] == 'a')
        a[tot].f = 1;
      else
        a[tot].f = 0;
      p += 3;
    }
  }
  void work() {
    sort(a + 1, a + tot + 1);
    long long ans = 0;
    for (int i = 1; i <= tot; i++) {
      ans += a[i].v * n;
      if (!a[i].f) ans += a[i].v;
      n++;
    }
    printf("%I64d\n", ans);
  }
} Program;
int main() {
  Program.init();
  Program.work();
  return 0;
}
