func_code_string: #include <bits/stdc++.h>   using namespace std;   struct sz {     long long f[2][2];   } a, b, c, z;   long long p, x, y, ans, dt;   int n, f[1000007];   sz chen(sz a, sz b) {     sz c;     c.f[0][0] = c.f[0][1] = c.f[1][0] = c.f[1][1] = 0;     for (int k = 0; k <= 1; k++)       for (int i = 0; i <= 1; i++)         for (int j = 0; j <= 1; j++)           c.f[i][j] = (c.f[i][j] + a.f[i][k] * b.f[k][j]) % p;     return c;   }   sz mi(sz a, long long x) {     if (x == 0) return z;     if (x == 1) return a;     sz b = mi(a, x >> 1);     b = chen(b, b);     if (x & 1) b = chen(b, a);     return b;   }   int main() {     z.f[0][0] = z.f[1][1] = 1;     z.f[0][1] = z.f[1][0] = 0;     cin >> n >> x >> y >> p;     for (int i = 1; i <= n; i++) scanf( %d , &f[i]);     if (n == 1) {       cout << ((f[1] % p) + p) % p;       return 0;     }     a.f[0][0] = a.f[0][1] = 1;     a.f[1][1] = 3;     if (x == 0) {       for (int i = 1; i <= n; i++) ans = (ans + f[i]) % p;       dt = f[1] + f[n];     } else {       b = mi(a, x);       for (int i = 1; i <= n; i++)         if (i == 1 || i == n)           ans = (ans + (b.f[0][1] * 1 + 1) * f[i]) % p;         else           ans = (ans + (b.f[0][1] * 2 + 1) * f[i]) % p;       c.f[0][0] = c.f[0][1] = c.f[1][0] = 1;       c.f[1][1] = 0;       b = mi(c, x);       dt = 0;       dt = (f[1] + f[n] * b.f[0][0] + f[n - 1] * b.f[0][1]) % p;     }     if (y != 0) {       b = mi(a, y);       ans = (ans * (b.f[0][1] * 2 + 1) - dt * b.f[0][1]) % p;     }     ans = (ans + p) % p;     cout << ans;     return 0;   }   