func_code_string: #include <bits/stdc++.h>   using namespace std;   long long fpow(long long n, long long k, long long p = 1000000007) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   long long inv(long long a, long long p = 1000000007) {     return fpow(a, p - 2, p);   }   long long fact[100001];   void pre() {     fact[0] = 1;     fact[1] = 1;     for (long long i = 2; i <= 100000; i++)       fact[i] = (i * fact[i - 1]) % 1000000007;   }   int main() {     pre();     long long n, k;     cin >> n >> k;     long long arr[n], cnt = 0;     map<long long, long long> m;     for (long long i = 0; i < n; i++) {       cin >> arr[i];       string temp = to_string(arr[i]);       long long flag = 1;       for (long long j = 0; j < temp.size(); j++) {         if (temp[j] ==  4  or temp[j] ==  7 ) {         } else {           flag = 0;           break;         }       }       if (flag) {         m[arr[i]]++;         cnt++;       }     }     long long dp[m.size()][m.size()];     vector<long long> freq;     memset(dp, 0, sizeof(dp));     for (map<long long, long long>::iterator it = m.begin(); it != m.end(); it++)       freq.push_back(it->second);     sort(freq.begin(), freq.end());     for (long long i = 0; i < freq.size(); i++) dp[0][i] = freq[i];     long long cutoff = m.size() - 2;     for (long long i = 1; i < m.size(); i++) {       long long sum = 0;       for (long long j = 0; j <= cutoff; j++) {         long long smallest = dp[0][j];         if (j == 0) {           for (long long k = j + 1; k <= cutoff + 1; k++) {             dp[i][j] =                 (dp[i][j] + (smallest * dp[i - 1][k]) % 1000000007) % 1000000007;             sum = dp[i][j];           }         } else {           sum = (sum * inv(dp[0][j - 1])) % 1000000007;           sum = (sum - dp[i - 1][j] + 1000000007) % 1000000007;           sum = (sum * dp[0][j]) % 1000000007;           dp[i][j] = sum;         }       }       cutoff--;     }     if (m.size() + n - cnt < k)       cout << 0;     else {       long long ans = 0;       for (long long i = 1; i <= min((long long)m.size(), k); i++) {         long long temp = 0;         if (k - i <= n - cnt) {           for (long long j = 0; j < m.size(); j++)             temp = (temp + dp[i - 1][j]) % 1000000007;           long long num = fact[n - cnt];           long long den = (fact[k - i] * fact[n - cnt - k + i]) % 1000000007;           num = (num * inv(den)) % 1000000007;           ans = (ans + (num * temp) % 1000000007) % 1000000007;         }       }       if (n - cnt >= k) {         long long num = fact[n - cnt];         long long den = (fact[k] * fact[n - cnt - k]) % 1000000007;         num = (num * inv(den)) % 1000000007;         ans = (ans + num) % 1000000007;       }       cout << ans;     }   }   