func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e13;   const int MAGIC = 3500000;   long long add(long long x, long long y) { return (x + y) % MOD; }   long long mul(long long x, long long y) {     long long coef = (long double)(x)*y / MOD + 0.5;     long long ret = x * y - coef * MOD;     ret += ret < 0 ? MOD : 0;     return ret;   }   struct mat {     long long dat[2][2];     mat() { memset(dat, 0, sizeof(dat)); }   } I, J;   mat operator*(const mat& A, const mat& B) {     mat ret;     for (int i = 0; i < (int)(2); i++)       for (int j = 0; j < (int)(2); j++)         ret.dat[i][j] =             add(mul(A.dat[i][0], B.dat[0][j]), mul(A.dat[i][1], B.dat[1][j]));     return ret;   }   void init() {     I.dat[0][0] = I.dat[1][1] = 1;     J.dat[1][0] = J.dat[0][1] = J.dat[1][1] = 1;   }   long long calc(long long pos) {     mat ans = I, cur = J;     while (pos > 0) {       if (pos & 1) ans = ans * cur;       cur = cur * cur;       pos >>= 1;     }     return ans.dat[1][0];   }   long long pw[14], cyc[14];   long long X;   int main() {     init();     scanf( %lld , &X);     pw[0] = 1;     for (int i = 1; i <= (int)(13); i++) pw[i] = 10 * pw[i - 1];     cyc[0] = 1;     cyc[1] = 60;     cyc[2] = 300;     cyc[3] = 1500;     for (int i = 4; i <= 13; i++) cyc[i] = 10 * cyc[i - 1];     vector<long long> occ, nocc;     occ.push_back(0);     for (int i = 1; i <= (int)(13); i++) {       int wt = cyc[i] / cyc[i - 1];       nocc.clear();       for (int j = 0; j < (int)(occ.size()); j++)         for (int k = 0; k < (int)(wt); k++)           if (calc(occ[j] + k * cyc[i - 1]) % pw[i] == X % pw[i])             nocc.push_back(occ[j] + k * cyc[i - 1]);       occ = nocc;     }     sort(occ.begin(), occ.end());     printf( %lld n , occ.empty() ? -1 : occ[0]);     return 0;   }   