func_code_string: #include <bits/stdc++.h>   using namespace std;   struct hash_pair {     template <class T1, class T2>     size_t operator()(const pair<T1, T2>& p) const {       auto hash1 = hash<T1>{}(p.first);       auto hash2 = hash<T2>{}(p.second);       return hash1 ^ hash2;     }   };   string ans =   ;   int flag = 0;   int res = 0;   void permut(string n, int s, int l) {     if (flag == 1) return;     if (s == l) {       if ((res * 10000 + stoi(n)) % 7 == 0) {         flag = 1;         ans += n;       }       return;     }     for (int i = s; i <= l; i++) {       swap(n[s], n[i]);       permut(n, s + 1, l);       swap(n[s], n[i]);     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     string n;     cin >> n;     int one = 0;     int six = 0;     int eight = 0;     int nine = 0;     string zero =   ;     for (int i = 0; i < n.length(); i++) {       if (n[i] ==  1  && one == 0) {         one = 1;       } else if (n[i] ==  6  && six == 0) {         six = 1;       } else if (n[i] ==  8  && eight == 0) {         eight = 1;       } else if (n[i] ==  9  && nine == 0) {         nine = 1;       } else {         if (n[i] ==  0  && ans.length() == 0) {           zero +=  0 ;         } else {           ans += n[i];           res *= 10;           res += n[i] -  0 ;           res %= 7;         }       }     }     permut( 1689 , 0, 3);     if (ans.length() != 0)       cout << ans + zero;     else       cout <<  0 ;   }   