boolcheck(int a, int b,int x){ while (x){ if (x % 10 != a && x % 10 != b) returnfalse; x /= 10; } returntrue; }
ll Pow_mod(ll a,ll n){ ll ret = 1; while (n){ if (n & 1) ret = ret * a % MOD; a = a * a % MOD; n >>= 1; } return ret; }
intmain(){ int a,b,n; cin >> a >> b >> n; int sum = 0; ll ret = 1; ll ans = 0; for (int i = 0; i <= n; i ++){ sum = a * i + b * (n - i); if (check(a,b,sum)){ ans = (ans + ret) % MOD; } ret = ret * (n - i) % MOD; ret = ret * Pow_mod(i + 1, MOD - 2) % MOD; } cout << ans << endl; return0; }