#include <bits/stdc++.h>
#define int LL
using namespace std;
typedef long long LL;
const int MAX_N=10005;
const int MAX_D=105;
const int Mod=1e9+7;
string k;
int D;
int dp[MAX_N][MAX_D];
int dfs(int pos,int sum,bool limit) {
	if (pos==k.size()) return (sum%D)?0:1;
	if (!limit && dp[pos][sum]!=-1) return dp[pos][sum];
	int u = limit?k[pos]-'0':9;
	int ret = 0;
	for (int i=0; i<=u; ++i) {
		ret += dfs(pos+1,(sum+i)%D,limit && i==k[pos]-'0');
		ret%=Mod;
	}
	if (!limit) dp[pos][sum] = ret;
	//  cout<<"dfs("<<pos<<","<<sum<<","<<limit<<")="<<ret<<endl;
	return ret;
}
signed main() {
	memset(dp,-1,sizeof(dp));
	cin>>k>>D;
	cout<<(dfs(0,0,true)-1+Mod)%Mod<<endl;
	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>
#define int LL
using namespace std;
typedef long long LL;
const int MAX_N=10005;
const int MAX_D=105;
const int Mod=1e9+7;
string k;
int D;
int dp[MAX_N][MAX_D];
int dfs(int pos,int sum,bool limit) {
	if (pos==k.size()) return (sum%D)?0:1;
	if (!limit && dp[pos][sum]!=-1) return dp[pos][sum];
	int u = limit?k[pos]-'0':9;
	int ret = 0;
	for (int i=0; i<=u; ++i) {
		ret += dfs(pos+1,(sum+i)%D,limit && i==k[pos]-'0');
		ret%=Mod;
	}
	if (!limit) dp[pos][sum] = ret;
	//  cout<<"dfs("<<pos<<","<<sum<<","<<limit<<")="<<ret<<endl;
	return ret;
}
signed main() {
	memset(dp,-1,sizeof(dp));
	cin>>k>>D;
	cout<<(dfs(0,0,true)-1+Mod)%Mod<<endl;
	return 0;
}

```