#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > A;
int N, l, i, Num, Add, Ans, p;
char S[10005];
int GetNum(int &i) {
  int s = 0;
  if (S[i] < '0' || S[i] > '9') return 1;
  for (; i < l && S[i] >= '0' && S[i] <= '9'; ++i) s = s * 10 + S[i] - '0';
  return s;
}
int GetAdd(int i) { return S[i] == '+'; }
int main() {
  scanf("%d", &N);
  scanf("%s", S);
  l = strlen(S);
  for (i = 0; i < l;) {
    if (S[i] == '-')
      p = -1;
    else
      p = 1;
    if (S[i] == '-' || S[i] == '+') ++i;
    Num = p * GetNum(i);
    if (S[i] == '*') ++i;
    Add = GetAdd(i);
    A.push_back(make_pair(Num, 1 - Add));
    i += 3;
  }
  sort(A.begin(), A.end());
  for (i = 0; i < A.size(); ++i) {
    Ans += A[i].first * (N + (1 - A[i].second));
    ++N;
  }
  printf("%d\n", Ans);
  return 0;
}
