#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const double PI = 3.141592653589793;
vector<int> co;
int a, i, l, res, znak;
string s, s2;
char t[10000];
int main() {
  scanf("%d %s", &a, &t);
  s = t;
  s2 = "";
  for (i = 0; i < s.size(); i++) {
    if (i < s.size() - 2) {
      if (s[i] == 'a' && s[i + 1] == '+' && s[i + 2] == '+') {
        s2 += 'a';
        i += 2;
      } else if (s[i] == '+' && s[i + 1] == '+' && s[i + 2] == 'a') {
        s2 += 'b';
        i += 2;
      } else
        s2 += s[i];
    } else
      s2 += s[i];
  }
  co.resize(0);
  res = 0;
  for (i = 0; i < s2.size(); i++) {
    if (i != 0) {
      if (s2[i] == '+')
        znak = 1;
      else
        znak = -1;
      i++;
    } else
      znak = 1;
    if (s2[i] > '9')
      l = 1;
    else
      l = 0;
    while (s2[i] <= '9' && s2[i] >= '0') {
      l = l * 10 + int(s2[i]) - 48;
      i++;
    }
    if (s2[i] == '*') i++;
    l *= znak;
    if (s2[i] == 'b') res += l;
    co.push_back(l);
  }
  sort(co.begin(), co.end());
  for (i = 0; i < co.size(); i++) {
    res += a * co[i];
    a++;
  }
  printf("%d\n", res);
  return 0;
}
