#include <bits/stdc++.h>
using namespace std;
char cc;
int a, sum, x, y, n;
int value[10000];
bool flag, temp;
void read(int &x) {
  char c = getchar();
  if (c >= '0' && c <= '9') {
    x = c - '0';
    while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
    cc = c;
    flag = 0;
  } else {
    getchar();
    getchar();
    temp = c == '+';
    cc = getchar();
    flag = 1;
  }
}
int main() {
  scanf("%d", &a);
  getchar();
  cc = '+';
  n = 0;
  while (1) {
    char ch = cc;
    if (ch != '+' && ch != '-') break;
    read(x);
    if (flag) {
      if (ch == '-')
        value[++n] = -1;
      else
        value[++n] = 1;
      if (temp) sum += value[n];
    } else {
      read(y);
      if (ch == '-')
        value[++n] = -x;
      else
        value[++n] = x;
      if (temp) sum += value[n];
    }
  }
  sort(value + 1, value + n + 1);
  for (int i = 1; i <= n; i++) sum += value[i] * a++;
  printf("%d\n", sum);
  return 0;
}
