func_code_string: #include <bits/stdc++.h>   using namespace std;   long long mini(long long a, long long b) {     if (a < b) return a;     return b;   }   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<long long> a(n);     for (int i = 0; i < n; ++i) cin >> a[i];     sort(a.begin(), a.end());     reverse(a.begin(), a.end());     for (int i = 1; i < n; ++i) a[i] += a[i - 1];     vector<long long> odp(n, 0);     for (int i = 1; i <= n - 1; ++i) {       for (long long il = 1, pos = 0, w = 0; pos < n; pos += il, il *= i, ++w) {         odp[i] += w * a[mini(n - 1, pos + il - 1)];         if (pos != 0) odp[i] -= w * a[pos - 1];       }     }     int q;     cin >> q;     for (int i = 0; i < q; ++i) {       int k;       cin >> k;       k = mini(k, n - 1);       cout << odp[k] <<    ;     }     return 0;   }   