func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<bool> flag_pr(10001000, 0), flag_pal(10001000, 0);   vector<long long> prime_upto(10001000, 0), palin_upto(10001000, 0);   int gcd(int a, int b) {     if (a % b == 0)       return b;     else       return gcd(b, a % b);   }   bool isPalin(int num) {     int ret = 0, n = num;     while (n > 0) {       int val = (n / 10) * 10;       int dig = n - val;       ret = ret * 10 + dig;       n /= 10;     }     if (ret == num)       return true;     else       return false;   }   void init() {     flag_pr[2] = 1;     for (int i = 3; i * i < 10001000; i += 2)       if (!flag_pr[i])         for (int j = 2 * i; j < 10001000; j += i) flag_pr[j] = 1;     prime_upto[2] = 1;     for (int i = 3; i < 10001000; i++) {       if (i & 1) {         prime_upto[i] = prime_upto[i - 1] + (flag_pr[i] == 0 ? 1 : 0);       } else {         prime_upto[i] = prime_upto[i - 1];       }     }     for (int i = 1; i < 10001000; i++) {       if (i == 1)         palin_upto[i] = 1;       else {         palin_upto[i] = palin_upto[i - 1] + isPalin(i);       }     }     return;   }   void solve() {     int p, q;     cin >> p >> q;     int g = gcd(p, q);     p /= g;     q /= g;     int ret = -1;     for (int i = 1; i < 10001000; i++) {       if (q * prime_upto[i] <= p * palin_upto[i]) {         ret = max(ret, i);       }     }     cout << ret <<   n ;     return;   }   int main() {     init();     solve();     return 0;   }   