func_code_string: #include <bits/stdc++.h>   using namespace std;   const double pi = 4.0 * atan(1.0);   int64_t num;   queue<int64_t> qu;   bool ifgood(int64_t x) {     int64_t a, b;     a = 0;     b = 0;     while (x) {       if (x % 10 == 4)         ++a;       else if (x % 10 == 7)         ++b;       else         return false;       x /= 10;     }     if (a == b) return true;     return false;   }   void bfs() {     while (!qu.empty()) qu.pop();     int64_t a, b, k;     a = 0;     qu.push(a);     while (!qu.empty()) {       b = qu.front();       if (b > num && ifgood(b)) return;       qu.pop();       k = b;       b = b * 10 + 4;       qu.push(b);       k = k * 10 + 7;       qu.push(k);     }     return;   }   int main() {     cin >> num;     if (ifgood(num))       cout << num << endl;     else {       bfs();       cout << qu.front() << endl;     }     return 0;   }   