#include <bits/stdc++.h>
using namespace std;
int a;
char s[1000005] = {};
vector<pair<long long int, bool> > Item;
inline void Work() {
  scanf("%d %s", &a, s + 1);
  int l = strlen(s + 1);
  for (register int i = 1; i <= l; ++i) {
    if (s[i] == 'a') {
      int CoeIndx, Isback = 0;
      long long int num;
      if (i > 2 && s[i - 1] == '+' && s[i - 2] == '+') {
        CoeIndx = i - 3;
      } else if (s[i + 2] == '+' && s[i + 1] == '+') {
        CoeIndx = i - 1, Isback = 1, s[i + 2] = '$';
      }
      bool Nonum = true;
      while (CoeIndx > 1 &&
             (('0' <= s[CoeIndx - 1] && s[CoeIndx - 1] <= '9' ||
               s[CoeIndx - 1] == '-' || s[CoeIndx - 1] == '*'))) {
        Nonum = false, --CoeIndx;
      }
      if (Nonum) {
        num = (s[CoeIndx] == '-') * -2 + 1;
      } else {
        sscanf(s + CoeIndx, "%lld", &num);
      }
      Item.push_back(make_pair(num, Isback));
    }
  }
  sort(Item.begin(), Item.end());
  long long int Ans = 0;
  for (pair<long long int, bool> k : Item) {
    Ans += k.first * (a++ + !k.second);
  }
  printf("%lld\n", Ans);
}
int main() {
  Work();
  return 0;
}
