func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int maxn = 2e3 + 1;   const int maxm = 2e3 + 1;   char a[maxn], b[maxn];   int num[maxn];   int m, d;   long long dp[maxn][maxm];   int len;   int judge(const char* s, int lena) {     int mod = 0;     for (int i = 1; i <= lena; i++) {       mod = (mod * 10 + s[i]) % m;       if ((i & 1) == 0 && s[i] != d) {         return 0;       }       if ((i & 1) && s[i] == d) return 0;     }     return (mod == 0);   }   int val[maxn];   long long dfs(int pos, int mod, bool limit) {     if (pos == len + 1) {       return mod == 0;     }     if (!limit && dp[pos][mod] != -1) return dp[pos][mod];     int up = (limit ? num[pos] : 9);     long long res = 0;     for (int i = 0; i <= up; i++) {       int tmod = (mod * 10 + i) % m;       if ((pos & 1) && (i == d)) continue;       if (!(pos & 1) && (i != d)) continue;       res = (res + dfs(pos + 1, tmod, limit && i == up)) % MOD;     }     if (!limit) dp[pos][mod] = res;     return res;   }   long long solve(const char* s, int lena) {     for (int i = 1; i <= lena; i++) num[i] = s[i];     len = lena;     memset(dp, -1, sizeof(dp));     return dfs(1, 0, true) % MOD;   }   int main() {     cin >> m >> d;     cin >> (a + 1);     cin >> (b + 1);     int lena = strlen(a + 1), lenb = strlen(b + 1);     for (int i = 1; i <= lena; i++) a[i] -=  0 ;     for (int i = 1; i <= lenb; i++) b[i] -=  0 ;     cout << ((solve(b, lenb) - solve(a, lena) + judge(a, lena)) % MOD + MOD) % MOD          << endl;     return 0;   }   