#include using namespace std; const long long int MOD = 1000000007LL; long long int dp[200010][3][8][2][2]; long long int solve(string s, int P, bool include_equal) { int d = 0; while(P % 10 == 0) d++, P /= 10; int N = s.length(); memset(dp, 0, sizeof(dp)); dp[0][0][0][0][0] = 1; for(int i=0; i= 1) maybe_ng = (maybe_ng - dp[N-d][mod3][0][inc3][1] + MOD) % MOD; if(include_equal) { (maybe_ng += dp[N][mod3][0][inc3][0]) %= MOD; if(N - d >= 1) maybe_ng = (maybe_ng - dp[N-d][mod3][0][inc3][0] + MOD) % MOD; } } } // printf("ret = %lld\n", (ret + maybe_ng) % MOD); return (ret + maybe_ng) % MOD; } int main() { string A, B; int P; cin >> A >> B >> P; long long int rr = solve(B, P, 1); long long int rl = solve(A, P, 0); cout << (rr - rl + MOD) % MOD << endl; return 0; }