func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 101000;   int fa[maxn], sz[maxn], c[maxn];   int fd(int f) { return fa[f] == f ? f : fa[f] = fd(fa[f]); }   int n, m, f[maxn];   bool isok(int x) {     while (x) {       int d = x % 10;       if (d != 4 && d != 7) return false;       x /= 10;     }     return true;   }   void bp(int v, int w) {     for (int i = n; i >= v; --i) f[i] = min(f[i], f[i - v] + w);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) fa[i] = i;     for (int i = 1; i <= m; ++i) {       int u, v;       scanf( %d%d , &u, &v);       fa[fd(u)] = fd(v);     }     for (int i = 1; i <= n; ++i) sz[fd(i)]++;     for (int i = 1; i <= n; ++i) c[sz[i]]++, f[i] = 1e9;     for (int i = 1; i <= n; ++i)       if (c[i]) {         for (int s = 1; s <= c[i]; s <<= 1) bp(s * i, s), c[i] -= s;         bp(c[i] * i, c[i]);       }     int ans = 1e9;     for (int i = 1; i <= n; ++i)       if (isok(i)) ans = min(ans, f[i]);     printf( %d n , ans == 1e9 ? -1 : ans - 1);     return 0;   }   