#include <bits/stdc++.h>
using namespace std;
long long int a, b, n;
int const mod = (1e9) + 7;
bool check(int sum) {
  while (sum) {
    if (sum % 10 != a && sum % 10 != b) return false;
    sum /= 10;
  }
  return true;
}
long long int fac[int(1e6 + 7)];
long long int powmd(long long int a, long long int n) {
  if (n == 0) return 1;
  long long int p = powmd(a, n / 2) % mod;
  p = ((p % mod) * (p % mod)) % mod;
  if (n % 2 == 1) {
    p = ((p % mod) * (a % mod)) % mod;
  }
  return p;
}
long long int modinv(long long int a, long long int md) {
  return powmd(a, md - 2);
}
long long int ncl(long long int n, long long int r) {
  long long int a = fac[n] % mod;
  long long int b = modinv(fac[r] % mod, mod) % mod;
  long long int c = modinv(fac[n - r] % mod, mod) % mod;
  long long int ans = (a * b) % mod;
  return (ans * c) % mod;
}
void solve() {
  cin >> a >> b >> n;
  long long int ans = 0;
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = ((i % mod) * (fac[i - 1] % mod)) % mod;
  for (long long int l = 0; l <= n; l++) {
    long long int sum = (n - l) * a + l * b;
    if (check(sum)) {
      ans = (ans % mod + ncl(n, l) % mod) % mod;
    }
  }
  cout << ((ans + mod) % mod) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
