func_code_string: #include <bits/stdc++.h>   using namespace std;   struct node {     long long v;     bool c;   } arr[12000];   bool comparator(node a, node b) { return a.v < b.v; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long i, j, p, v, l, n = 0, a, ans = 0;     cin >> a;     string s;     cin >> s;     l = s.length();     s =  +  + s;     for (i = 0; i < l; i += 3) {       v = 0;       p = s[i++] ==  +  ? 1 : -1;       if (s[i] >=  0  and s[i] <=  9 )         for (; s[i] >=  0  and s[i] <=  9 ; i++) v = v * 10 + s[i] - 48;       else         v = 1;       if (s[i] ==  * ) i++;       n++;       arr[n].v = v * p;       arr[n].c = s[i] ==  a ;     }     sort(arr + 1, arr + 1 + n, comparator);     for (i = 1; i <= n; i++) {       if (arr[i].c)         ans += arr[i].v * a++;       else         ans += arr[i].v * ++a;     }     cout << ans << endl;     return 0;   }   