#include <bits/stdc++.h>
using namespace std;
const long long N = 5e6 + 5, MOD = 1e9 + 7;
long long a, b, n;
long long ret;
long long Fpow(long long b, long long os) {
  if (os == 0) return 1;
  long long cur = Fpow(b, os / 2);
  cur = (cur % MOD * cur % MOD) % MOD;
  if (os & 1) return (b % MOD * cur % MOD) % MOD;
  return cur;
}
long long fact[N];
long long inv(long long x) { return Fpow(x, MOD - 2); }
long long choose(long long n, long long i) {
  return fact[n] % MOD * inv(fact[i] % MOD * fact[n - i] % MOD) % MOD;
}
bool good(long long x) {
  long long cnt = 0;
  while (x) {
    cnt = x % 10;
    if (cnt != a && cnt != b) return 0;
    x /= 10;
  }
  return 1;
}
void fac() {
  fact[0] = 1;
  for (int i = 1; i < N; ++i) {
    fact[i] = (fact[i - 1] % MOD * i % MOD) % MOD;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fac();
  cin >> a >> b >> n;
  for (int i = 0; i <= n; i++) {
    long long sum = i * b + (n - i) * a;
    if (good(sum)) {
      ret = (ret % MOD + choose(n, i)) % MOD;
    }
  }
  cout << ret << "\n";
}
