func_code_string: #include <bits/stdc++.h>   using vi = std::vector<long long int>;   using vvi = std::vector<vi>;   using pii = std::pair<long long int, long long int>;   using vpii = std::vector<pii>;   using vvpii = std::vector<vpii>;   using namespace std;   const long long int N = 2e6 + 10;   const long long int inf = 1e18 + 10;   const long long int M = 1e9 + 7;   const long double Pi = 3.14159265;   long long int n, b, k, x, a[N];   long long int mul(long long int a, long long int b) {     return ((a % M) * (b % M)) % M;   }   long long int add(long long int a, long long int b) {     return ((a % M) + (b % M)) % M;   }   vvi p(vvi a, vvi b) {     vvi x(n, vi(n, 0));     for (long long int i = 0; i <= n - 1; i++)       for (long long int j = 0; j <= n - 1; j++)         for (long long int k = 0; k <= n - 1; k++)           x[i][j] = add(x[i][j], mul(a[i][k], b[k][j]));     return x;   }   vvi matrix_power_final(vvi A, long long int x) {     vvi result(n, vi(n, 0));     for (long long int i = 0; i <= n - 1; i++) result[i][i] = 1;     while (x) {       if (x & 1) result = p(result, A);       A = p(A, A);       x = x / 2;     }     return result;   }   void solve() {     cin >> n >> b >> k >> x;     vvi v(x, vi(x, 0));     for (long long int i = 1; i <= n; i++) {       cin >> a[i];     }     for (long long int i = 1; i <= n; i++) {       for (long long int j = 0; j <= x - 1; j++) {         a[i] %= x;         v[j][(j * 10 + a[i]) % x]++;       }     }     n = x;     v = matrix_power_final(v, b);     cout << v[0][k];   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     solve();     long long int xx = 0;     return 0;   }   