#include <bits/stdc++.h>
using namespace std;
struct Data {
  bool Flag;
  int Value;
};
bool operator<(Data A, Data B) { return A.Value < B.Value; }
int main() {
  int a;
  scanf("%d", &a);
  string S = "";
  char c;
  while (c = getchar(), c != -1)
    if ((c >= '0' && c <= '9') || (c == '+') || (c == '-') || (c == 'a') ||
        (c == '*'))
      S += c;
  if (S[0] != '-') S = '+' + S;
  int N = 0;
  static Data A[10000];
  for (int i = 0; i < S.size(); i += 3) {
    bool Flag = (S[i++] == '+');
    int C = 0;
    if (S[i] >= '0' && S[i] <= '9') {
      while (S[i] != '*') C = C * 10 + S[i++] - 48;
      i++;
    } else
      C = 1;
    A[N++] = (Data){S[i] == '+', Flag ? C : -C};
  }
  sort(A, A + N);
  long long Ans = 0;
  for (int i = 0; i < N; i++)
    if (A[i].Flag)
      Ans += A[i].Value * (++a);
    else
      Ans += A[i].Value * (a++);
  cout << Ans << endl;
  return 0;
}
