#include <bits/stdc++.h>
using namespace std;
struct ppap {
  int co;
  int key;
} num[1010];
int coe;
string s;
int a;
int cmp(const ppap &x, const ppap &y) { return x.co < y.co; }
int main() {
  cin >> a >> s;
  coe = 1;
  int top = 1, poi = 0, len = -1;
  for (int i = 1; i <= 1000; i++) num[i].co = 1;
  while (poi < s.size()) {
    if (s[poi] == '-')
      coe = -1, poi++;
    else if (s[poi] == '*' || s[poi] == '+')
      poi++;
    else if (s[poi] == 'a') {
      if (poi - 2 > len && s[poi - 1] == '+' && s[poi - 2] == '+') {
        len = poi;
        num[top].co *= coe;
        num[top].key = 0;
        top++;
        poi++;
      } else {
        len = poi + 2;
        num[top].co *= coe;
        num[top].key = 1;
        top++;
        poi += 3;
      }
      coe = 1;
    } else {
      int n = 0;
      while (s[poi] >= '0' && s[poi] <= '9') {
        n = n * 10 + (s[poi] - '0');
        poi++;
      }
      num[top].co = n;
    }
  }
  top--;
  sort(num + 1, num + 1 + top, cmp);
  int ans = 0;
  for (int i = 1; i <= top; i++) {
    if (!num[i].key)
      a++, ans += (num[i].co * a);
    else
      ans += (num[i].co * a), a++;
  }
  printf("%d\n", ans);
  return 0;
}
