func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<string> tmp;   long long num(string str) {     int len = str.size();     long long res = 0;     for (int i = 0; i < len; i++) {       res = res * 10 + str[i] -  0 ;     }     return res;   }   void solve(int N) {     queue<string> q;     q.push( 11 );     q.push( 22 );     q.push( 33 );     q.push( 44 );     q.push( 55 );     q.push( 66 );     q.push( 77 );     q.push( 88 );     q.push( 99 );     tmp.push_back( 11 );     tmp.push_back( 22 );     tmp.push_back( 33 );     tmp.push_back( 44 );     tmp.push_back( 55 );     tmp.push_back( 66 );     tmp.push_back( 77 );     tmp.push_back( 88 );     tmp.push_back( 99 );     while (!q.empty()) {       string str = q.front();       q.pop();       if (tmp.size() >= N) return;       for (int i = 0; i < 10; i++) {         char ch = i + 48;         int l = str.size() / 2;         string kp = str.substr(0, l) + ch + ch + str.substr(l, l);         tmp.push_back(kp);         q.push(kp);       }     }   }   int main() {     int k, p;     scanf( %d%d , &k, &p);     solve(k);     long long res = 0;     for (int i = 0; i < k; i++) {       res = (res + num(tmp[i])) % p;     }     cout << res << endl;     return 0;   }   