func_code_string: #include <bits/stdc++.h>   using namespace std;   string a, b;   int m, d;   long long int memo[2000][2000][2][2];   long long int dp(int i, int rem, bool hf, bool lf) {     if (i >= a.length()) {       if (rem == 0) {         return 1;       }       return 0;     }     if (memo[i][rem][hf][lf] != -1) return memo[i][rem][hf][lf];     int lo = 0;     int hi = 9;     if (lf) lo = b[i] -  0 ;     if (hf) hi = a[i] -  0 ;     long long int ans = 0;     if (i % 2 == 0) {       for (int j = lo; j <= hi; j++) {         if (j == d) continue;         ans += dp(i + 1, (rem * 10 + j) % m, hf & (j == (a[i] -  0 )),                   lf & (j == (b[i] -  0 )));         ans %= 1000000007;       }     } else {       if ((d >= lo) && (d <= hi))         ans += dp(i + 1, (rem * 10 + d) % m, hf & (d == (a[i] -  0 )),                   lf & (d == (b[i] -  0 )));       ans %= 1000000007;     }     memo[i][rem][hf][lf] = ans;     return ans;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     cin >> m >> d;     cin >> b >> a;     for (int i = 0; i < 2000; i++) {       for (int j = 0; j < 2000; j++) {         for (int k = 0; k < 2; k++) {           for (int l = 0; l < 2; l++) {             memo[i][j][k][l] = -1;           }         }       }     }     cout << dp(0, 0, 1, 1) <<   n ;   }   