#include <bits/stdc++.h>
using namespace std;
long long bs(vector<long long> arr, long long p, long long r, long long num) {
  if (p <= r) {
    long long mid = (p + r) / 2;
    if (arr[mid] == num) return mid;
    if (arr[mid] > num) return bs(arr, p, mid - 1, num);
    if (arr[mid] < num) return bs(arr, mid + 1, r, num);
  }
  return -1;
}
bool isprime(long long a) {
  if (a == 2 || a == 3 || a == 5) return true;
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
vector<bool> SieveOfEratosthenes(long long n) {
  vector<bool> prime(n + 1, true);
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  return prime;
}
map<long long, long long> prime_factorisation(long long n) {
  map<long long, long long> mp;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      mp[i]++;
      n /= i;
    }
  }
  if (n != 1) mp[n]++;
  return mp;
}
long long sti(string s) {
  long long ans = s[0] - '0';
  for (long long i = 1; i < s.size(); i++) ans = ans * 10 + (s[i] - '0');
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long LCM(long long i, long long j) { return (i * j) / gcd(i, j); }
long long a, b, n;
const long long mod = 1e9 + 7;
long long fastpow(long long a, long long b) {
  if (b == 0) return 1;
  long long fele = fastpow(a, b / 2);
  long long ans = (fele * fele) % mod;
  if (b & 1) ans = (ans * a) % mod;
  return ans;
}
void Aayush() {
  long long fact[(long long)1e6 + 1];
  fact[0] = 1;
  for (long long i = 1; i <= (long long)1e6; ++i) {
    fact[i] = fact[i - 1] * i % mod;
  }
  cin >> a >> b >> n;
  long long ans = 0;
  for (long long i = 0; i <= n; ++i) {
    long long val = i * a + (n - i) * b;
    bool ok = true;
    while (val > 0) {
      ok &= (val % 10 == a || val % 10 == b);
      val /= 10;
    }
    if (ok) {
      ans += (fact[n] * fastpow(fact[i], mod - 2) % mod *
              fastpow(fact[n - i], mod - 2) % mod) %
             mod;
      ans %= mod;
    }
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) Aayush();
  return 0;
}
