#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
const double PI = acos((double)-1);
int ts, ts2, ts3, ts4;
int n, m, st;
string s;
long long gcd(long long x, long long y) {
  long long t;
  for (; y != 0;) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
int a[100005], a2;
int main() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  int tt1, tt2, tt3, tt4;
  double u1, u2, u3, u4, u5, u6, u7, u8, u9;
  char c1, c2, c3;
  srand((unsigned)time(0));
  cin >> st;
  scanf("%*c");
  getline(cin, s);
  if (s[0] != '-') s = '+' + s;
  int ans = 0;
  for (i = 0; i < s.size(); i += 3) {
    t1 = 1;
    if (s[i] == '-') t1 = -1;
    t2 = 0;
    i++;
    for (; isdigit(s[i]); i++) t2 = t2 * 10 + s[i] - 48;
    t2 = t1 * t2;
    if (s[i] == '*')
      i++;
    else
      t2 = 1 * t1;
    if (s[i] != '+') ans -= t2;
    a[++a2] = t2;
  }
  sort(a + 1, a + a2 + 1);
  for (i = 1; i <= a2; i++) st++, ans += a[i] * st;
  cout << ans << endl;
  return 0;
}
