func_code_string: #include <bits/stdc++.h>   using namespace std;   int last1[510][5010], last2[510][5100], pre[510][5100];   int main() {     int s, d;     cin >> s >> d;     memset(last1, -1, sizeof(last1));     memset(last2, -1, sizeof(last2));     memset(pre, -1, sizeof(pre));     queue<pair<int, int> > q;     q.push(make_pair(0, 0));     while (!q.empty()) {       pair<int, int> cur = q.front();       q.pop();       for (int i = 0; i < 10; i++) {         if (i == 0 && cur.first == 0 && cur.second == 0) continue;         int nx1 = (cur.first * 10 + i) % s, nx2 = cur.second + i;         if (nx2 > d) continue;         if (pre[nx1][nx2] != -1) continue;         last1[nx1][nx2] = cur.first, last2[nx1][nx2] = cur.second;         pre[nx1][nx2] = i;         q.push(make_pair(nx1, nx2));       }     }     if (pre[0][d] == -1) {       cout << -1;       return 0;     }     vector<int> ans;     int nx1 = 0, nx2 = d;     while (1) {       if (pre[nx1][nx2] == -1) break;       ans.push_back(pre[nx1][nx2]);       int tmp1 = last1[nx1][nx2];       int tmp2 = last2[nx1][nx2];       nx1 = tmp1, nx2 = tmp2;     }     for (int i = ans.size() - 1; i >= 0; i--) {       cout << ans[i];     }     return 0;   }   