func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXS = 75, MAXK = 10, MAXQ = 30;   const long long INF = 0x3f3f3f3f3f3f3f3f;   int x, k, n, q, c[MAXK];   struct node {     int p, w;   } d[MAXQ];   bool operator<(const node &aa, const node &bb) { return aa.p < bb.p; }   int sta[MAXS], scn, cnt[300], id[300];   struct Matrix {     long long s[MAXS][MAXS];     Matrix() { memset(s, 0x3f, sizeof(s)); }   } X, A, pw[30];   Matrix operator*(const Matrix &aa, const Matrix &bb) {     Matrix cc;     for (int i = 1; i <= scn; i++)       for (int j = 1; j <= scn; j++)         for (int k = 1; k <= scn; k++)           cc.s[i][j] = min(cc.s[i][j], aa.s[i][k] + bb.s[k][j]);     return cc;   }   void build_pw() {     pw[0] = X;     for (int i = 1; i < 30; i++) pw[i] = pw[i - 1] * pw[i - 1];   }   Matrix get(int a) {     Matrix ret;     for (int i = 1; i <= scn; i++) ret.s[i][i] = 0;     for (int i = 0; i < 30; i++)       if (a >> i & 1) ret = ret * pw[i];     return ret;   }   int main() {     scanf( %d%d%d%d , &x, &k, &n, &q);     for (int i = 1; i <= k; i++) scanf( %d , &c[i]);     for (int i = 1; i <= q; i++) scanf( %d%d , &d[i].p, &d[i].w);     sort(d + 1, d + q + 1);     for (int s = 1; s < (1 << k); s++) {       cnt[s] = cnt[s >> 1] + (s & 1);       if (cnt[s] == x) sta[++scn] = s, id[s] = scn;     }     for (int i = 1; i <= scn; i++) {       if (sta[i] & 1) {         for (int j = 1; j <= k; j++)           if (!(sta[i] >> j & 1)) X.s[i][id[(sta[i] | (1 << j)) >> 1]] = c[j];       } else         X.s[i][id[sta[i] >> 1]] = 0;     }     build_pw();     int cur = 1;     long long delta = 0;     for (int i = 1; i <= scn; i++) A.s[i][i] = 0;     for (int i = 1; i <= q; i++) {       if (d[i].p > n - x)         delta += d[i].w;       else {         A = A * get(d[i].p - cur), cur = d[i].p;         for (int j = 1; j <= scn; j++)           for (int k = 1; k <= scn; k++)             if (sta[k] & 1) A.s[j][k] += d[i].w;       }     }     A = A * get(n - x + 1 - cur);     printf( %lld n , A.s[1][1] + delta);     return 0;   }   