#include <bits/stdc++.h>

const long long mo=1000000000+7;

std::string K;
int D;
long long dp[2][100][10001];//1:strict

int main(){
  std::cin >> K;
  std::cin >> D;
  dp[1][0][0]=1;
  for(int i=0;i<(int)(K.length());++i){
    for(int k=0;k<D;++k){
      for(int j=0;j<=9;++j){
	int nk=(j+k)%D;
	dp[0][nk][i+1]+=dp[0][k][i];
	dp[0][nk][i+1]%=mo;
      }
      for(int j=0;j<(int)(K[i]-'0');++j){
	int nk=(j+k)%D;
	dp[0][nk][i+1]+=dp[1][k][i];
	dp[0][nk][i+1]%=mo;
      }
      int nk=(k+(int)(K[i]-'0'))%D;
      dp[1][nk][i+1]+=dp[1][k][i];
      dp[1][nk][i+1]%=mo;
    }
  }
  std::cout<<(dp[0][0][(int)(K.length())]+dp[1][0][(int)(K.length())]+mo-1)%mo<<std::endl;
  return 0; 
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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>

const long long mo=1000000000+7;

std::string K;
int D;
long long dp[2][100][10001];//1:strict

int main(){
  std::cin >> K;
  std::cin >> D;
  dp[1][0][0]=1;
  for(int i=0;i<(int)(K.length());++i){
    for(int k=0;k<D;++k){
      for(int j=0;j<=9;++j){
	int nk=(j+k)%D;
	dp[0][nk][i+1]+=dp[0][k][i];
	dp[0][nk][i+1]%=mo;
      }
      for(int j=0;j<(int)(K[i]-'0');++j){
	int nk=(j+k)%D;
	dp[0][nk][i+1]+=dp[1][k][i];
	dp[0][nk][i+1]%=mo;
      }
      int nk=(k+(int)(K[i]-'0'))%D;
      dp[1][nk][i+1]+=dp[1][k][i];
      dp[1][nk][i+1]%=mo;
    }
  }
  std::cout<<(dp[0][0][(int)(K.length())]+dp[1][0][(int)(K.length())]+mo-1)%mo<<std::endl;
  return 0; 
}

```