func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 100005, inf = 1e9 + 7;   int fa[maxn];   long long n, m, dp[maxn];   int sz[maxn], costs[maxn];   vector<int> fas;   bool vis[maxn];   int findfa(int x) {     if (fa[x] == x)       return x;     else       return fa[x] = findfa(fa[x]);   }   void bag(int wei, int val) {     for (int i = n; i >= wei; i--) {       dp[i] = min(dp[i], dp[i - wei] + val);     }   }   bool check(int xx) {     while (xx) {       if ((xx % 10) != 4 && (xx % 10) != 7) {         return 0;       }       if (xx < 10) break;       xx /= 10;     }     return 1;   }   int main() {     memset(dp, 1e9 + 7, sizeof(dp));     cin >> n >> m;     for (int i = 1; i <= n; i++) fa[i] = i;     for (int i = 1; i <= m; i++) {       int x, y;       cin >> x >> y;       fa[findfa(x)] = findfa(y);     }     for (int i = 1; i <= n; i++) {       sz[findfa(i)]++;     }     for (int i = 1; i <= n; i++) {       costs[sz[i]]++;     }     dp[0] = 0;     for (int i = 1; i <= n; i++) {       if (costs[i]) {         for (int j = 1; j <= costs[i]; j <<= 1) {           bag(j * i, j);           costs[i] -= j;         }         bag(costs[i] * i, costs[i]);       }     }     long long ans = 1e9 + 7;     for (int i = 1; i <= n; i++) {       if (check(i)) ans = min(ans, dp[i]);     }     if (ans == 1e9 + 7)       cout <<  -1  << endl;     else       cout << ans - 1 << endl;     return 0;   }   