#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long dp[10][100010] = { 0 }; int main() { string s; cin >> s; dp[0][0] = 1; for (int i = 0; i < s.size(); i++) { if (s[i] == '?') { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { int d = (j + k) / 10 + (j + k) % 10; d = d / 10 + d % 10; d = d / 10 + d % 10; dp[d][i + 1] += dp[j][i]; dp[d][i + 1] %= 1000000007; } } } else { for (int j = 0; j < 10; j++) { int d = (j + int(s[i] - '0')) / 10 + (j + int(s[i] - '0')) % 10; d = d / 10 + d % 10; d = d / 10 + d % 10; dp[d][i + 1] += dp[j][i]; dp[d][i + 1] %= 1000000007; } } } int di; cin >> di; cout << dp[di][s.size()] << endl; return 0; }