#include <bits/stdc++.h>
using namespace std;
bool isGood(unsigned long long n, unsigned long long a, unsigned long long b) {
  unsigned long long cnt_a = 0, cnt_b = 0, d = 0;
  while (n > 0) {
    int rem = n % 10;
    if (rem == a)
      cnt_a++;
    else if (rem == b)
      cnt_b++;
    n /= 10;
    d++;
  }
  return (d == (cnt_a + cnt_b));
}
unsigned long long power(unsigned long long x, int y, int p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
unsigned long long modInverse(unsigned long long n, int p) {
  return power(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n, int r, int p) {
  if (r == 0) return 1;
  unsigned long long fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unsigned long long a, b, n;
  cin >> a >> b >> n;
  unsigned long long max = b * n;
  unsigned long long min = a * n;
  unsigned long long ans = 0;
  unsigned long long mod = 1000000007;
  for (unsigned long long i = min; i <= max; i++) {
    if (isGood(i, a, b)) {
      unsigned long long y_num = i - (a * n);
      unsigned long long y_denm = b - a;
      if (y_num % y_denm == 0) {
        unsigned long long y = y_num / y_denm;
        unsigned long long x = n - y;
        ans = ((ans % mod) + (nCrModPFermat(n, y, mod) % mod)) % mod;
      }
    }
  }
  cout << ans;
  return 0;
}
