#include <bits/stdc++.h>
using namespace std;
clock_t time_p = clock();
void time() {
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p) / CLOCKS_PER_SEC << '\n';
}
const long long mod = 1e9 + 7;
long long add(long long a, long long b) { return (a % mod + b % mod) % mod; }
long long sub(long long a, long long b) {
  return (a % mod - b % mod + mod) % mod;
}
long long mul(long long a, long long b) {
  a %= mod;
  b %= mod;
  return a * b % mod;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    x = (x * x) % p;
    y >>= 1;
  }
  return res;
}
long long inverse(long long a) { return power(a, mod - 2, mod); }
bool check(long long sum, long long a, long long b) {
  while (sum > 0) {
    if (sum % 10 != a && sum % 10 != b) return false;
    sum /= 10;
  }
  return true;
}
long long fact[1000004];
long long inv_fact[1000004];
void pre() {
  fact[0] = 1;
  inv_fact[0] = inverse(fact[0]);
  for (long long i = 1; i <= 1000000; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
    inv_fact[i] = inverse(fact[i]);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  pre();
  long long a, b, n;
  cin >> a >> b >> n;
  long long res = 0;
  for (long long i = 0; i <= n; i++) {
    long long sum = a * i + b * (n - i);
    if (check(sum, a, b)) {
      long long ans = 1;
      ans = mul(ans, fact[n]);
      ans = mul(ans, inv_fact[n - i]);
      ans = mul(ans, inv_fact[i]);
      res = add(res, ans);
    }
  }
  cout << res << '\n';
  time();
  return 0;
}
