#include <bits/stdc++.h>
using namespace std;
bool isnum(char digit) {
  if (digit == '0') return true;
  if (digit == '1') return true;
  if (digit == '2') return true;
  if (digit == '3') return true;
  if (digit == '4') return true;
  if (digit == '5') return true;
  if (digit == '6') return true;
  if (digit == '7') return true;
  if (digit == '8') return true;
  if (digit == '9') return true;
  return false;
}
bool comparison(deque<char>& filtro, string a) {
  for (long long i = 0; i < filtro.size(); i++) {
    if (filtro[i] != a[i]) return false;
  }
  return true;
}
bool cmp(pair<long long, bool> a, pair<long long, bool> b) {
  return a.first < b.first;
}
int main() {
  long long a, n, j, sum = 0;
  string input, num;
  deque<char> filtro;
  deque<pair<long long, bool> > ans;
  cin >> a >> input;
  input = "l" + input + "l";
  for (int i = input.size() - 2; i > input.size() - 5; i--)
    filtro.push_front(input[i]);
  for (long long i = input.size() - 5; i > -1; i--) {
    num = "";
    if (comparison(filtro, "a++")) {
      filtro[0] = 'b';
      filtro[1] = '-';
      filtro[2] = '-';
      if (input[i] == '*') {
        for (j = i - 1; isnum(input[j]); j--) num = input.substr(j, 1) + num;
        stringstream ss(num);
        ss >> n;
        if (input[j] == '-') n = -1 * n;
        ans.push_back(make_pair(n, 0));
      } else if (input[i] == '-') {
        ans.push_back(make_pair(-1, 0));
      } else
        ans.push_back(make_pair(1, 0));
    } else if (comparison(filtro, "++a")) {
      filtro[2] = 'b';
      filtro[1] = '-';
      filtro[0] = '-';
      if (input[i] == '*') {
        for (j = i - 1; isnum(input[j]); j--) num = input.substr(j, 1) + num;
        stringstream ss(num);
        ss >> n;
        if (input[j] == '-') n = -1 * n;
        ans.push_back(make_pair(n, 1));
      } else if (input[i] == '-') {
        ans.push_back(make_pair(-1, 1));
      } else
        ans.push_back(make_pair(1, 1));
    }
    filtro.pop_back();
    filtro.push_front(input[i]);
  }
  sort(ans.begin(), ans.end(), cmp);
  for (long long i = 0; i < ans.size(); i++) {
    if (ans[i].second == 1) {
      a++;
      sum += ans[i].first * a;
    } else {
      sum += ans[i].first * a;
      a++;
    }
  }
  cout << sum << endl;
  return 0;
}
