#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll; 
typedef long double ld; 
const ll mod = 1e9+7;

ll dp[10001][101][2];
ll solve( string & k, int& D, int pos , int d , bool tight)
{	if(dp[pos][d][tight] != -1)
		return dp[pos][d][tight];
		
	int ub = (tight) ? (k[pos]-'0') : 9 ;
	if(pos == k.length() - 1){
		ll ans = 0;
		for(int x = 0; x <= ub ; x++)
			if(x%D == d)
				ans++;
		return ans;
	}
	else{
	ll ans = 0;
	for(int x = 0; x <= ub; x++)
		ans = (ans + solve( k , D, pos+1, (D + d - x%D)%D , tight&&(x == ub)))%mod;
	return dp[pos][d][tight] = ans;
	}
} 
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int d;
	string k;
	cin >> k >> d;
	memset(dp, -1, sizeof(dp));
	cout << (mod+solve(k, d, 0, 0, 1)-1)%mod;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#define mod 998244353
#define ll long long
#define N 1000005
#define inv 499122177

using namespace std;

int n, m;
ll fac[N], ifac[N];
ll ans;

void init();
ll quick_pow(ll ,int);
ll C(int ,int);

int main(){
	cin >> n >> m;init();
	if(n < m) swap(n, m);
	for(int i = 1; i <= m; ++i){
		int x = n - i, y = m - i;
		(ans += C(i, 2 * i) * C(x, x + y) % mod) %= mod;
	}
	(ans *= quick_pow(C(n, n + m), mod - 2) * inv % mod) %= mod;
	(ans += n) %= mod;
	cout << ans << endl;
}

void init(){
	fac[0] = 1;ifac[0] = 1;
	for(int i = 1; i <= 1e6; ++i)
		fac[i] = fac[i - 1] * i % mod, ifac[i] = quick_pow(fac[i], mod - 2);
	return ;
}

ll C(int x,int y){
	return fac[y] * ifac[y - x] % mod * ifac[x] % mod;
}

ll quick_pow(ll x,int y){
	ll sum = 1, a = x;
	while(y){
		if(y & 1) (sum *= a) %= mod;
		(a *= a) %= mod;
		y >>= 1;
	}
	return sum;
}
