func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   signed main() {     long long n, sum = 0, temp;     multiset<long long> a;     cin >> n;     for (long long i = 0; i < n; ++i) {       cin >> temp;       a.insert(temp);     }     while (a.size() > 1) {       long long temp_sum = 0, sz = a.size();       for (long long j = 0; j < ((sz % 2 == 0) ? 2 : min(3ll, sz)); ++j) {         temp_sum += *a.begin();         a.erase(a.begin());       }       sum += temp_sum;       a.insert(temp_sum);     }     cout << sum;     return 0;   }   