#include<bits/stdc++.h>
using namespace std;

const int MOD = 1e9+7;

string s;
int d;

int memo[10005][105][3];

int dp(int idx, int tot, int stat){
   if(idx>=s.size()){
      if(tot == 0) return 1;
      else return 0;
   }
   int &ret = memo[idx][tot][stat];
   if(ret!=-1) return ret;
   ret = 0;
   for(int i=0;i<10;i++){
      if(stat == 0 && i>s[idx]-'0') break;
      if(s[idx]-'0' == i && stat == 0) ret+= dp(idx+1,(tot+i)%d,0);
      else ret+= dp(idx+1,(tot+i)%d,1);
      ret%=MOD;
   }
   return ret;
}

int main(){
   memset(memo,-1,sizeof(memo));
   cin >> s;
   cin >> d;
   int ans = dp(0,0,0);
   printf("%d\n",(ans+MOD-1)%MOD);
	return 0;
}

### Prompt

Develop a solution in Cpp to the problem described below:

Find the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:

* The sum of the digits in base ten is a multiple of D.

Constraints

* All values in input are integers.
* 1 \leq K < 10^{10000}
* 1 \leq D \leq 100

Input

Input is given from Standard Input in the following format:


K
D


Output

Print the number of integers satisfying the condition, modulo 10^9 + 7.

Examples

Input

30
4


Output

6


Input

1000000009
1


Output

2


Input

98765432109876543210
58


Output

635270834

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;

const int MOD = 1e9+7;

string s;
int d;

int memo[10005][105][3];

int dp(int idx, int tot, int stat){
   if(idx>=s.size()){
      if(tot == 0) return 1;
      else return 0;
   }
   int &ret = memo[idx][tot][stat];
   if(ret!=-1) return ret;
   ret = 0;
   for(int i=0;i<10;i++){
      if(stat == 0 && i>s[idx]-'0') break;
      if(s[idx]-'0' == i && stat == 0) ret+= dp(idx+1,(tot+i)%d,0);
      else ret+= dp(idx+1,(tot+i)%d,1);
      ret%=MOD;
   }
   return ret;
}

int main(){
   memset(memo,-1,sizeof(memo));
   cin >> s;
   cin >> d;
   int ans = dp(0,0,0);
   printf("%d\n",(ans+MOD-1)%MOD);
	return 0;
}

```