#include <bits/stdc++.h>
using namespace std;
const int INF = 123456789;
template <class T>
void scanint(T& x) {
  register int c = getchar();
  x = 0;
  int m = 0;
  if (c == '-') {
    m = 1;
  }
  for (; (c < 48 || c > 57); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (m == 1) {
    x *= -1;
  }
}
template <typename T>
void cinall(T& t) {
  cin >> t;
}
template <typename T, typename... Args>
void cinall(T& t, Args&... args) {
  cin >> t;
  cinall(args...);
}
const long long c_mod = 1000000007;
int fact[1000001] = {1};
int mInv[1000001] = {1};
bool onlyab(int n, int a, int b) {
  if (n == 0) {
    return false;
  }
  while (n > 0) {
    int rem = n % 10;
    n /= 10;
    if (a == rem || b == rem) {
      continue;
    } else {
      return false;
    }
  }
  return true;
}
pair<long long, pair<long long, long long> > extendedEuclid(long long a,
                                                            long long b) {
  long long x = 1, y = 0;
  long long xLast = 0, yLast = 1;
  long long q, r, m, n;
  while (a != 0) {
    q = b / a;
    r = b % a;
    m = xLast - q * x;
    n = yLast - q * y;
    xLast = x, yLast = y;
    x = m, y = n;
    b = a, a = r;
  }
  return make_pair(b, make_pair(xLast, yLast));
}
long long modInverse(long long a, long long m) {
  return (extendedEuclid(a, m).second.first + m) % m;
}
void prep() {
  fact[0] = 1;
  mInv[0] = 1;
  for (int i = 1; i <= 1000000; ++i) {
    fact[i] = (((fact[i - 1]) % (c_mod)) * ((i) % (c_mod))) % c_mod;
    mInv[i] = (((mInv[i - 1]) % (c_mod)) * ((modInverse(i, c_mod)) % (c_mod))) %
              c_mod;
  }
}
long long ncr(int n, int r) {
  if (n == r || r == 0) {
    return 1;
  }
  int s = max(r, n - r);
  long long res = fact[n];
  res = (((res) % (c_mod)) * ((mInv[r]) % (c_mod))) % c_mod;
  res = (((res) % (c_mod)) * ((mInv[n - r]) % (c_mod))) % c_mod;
  return res % c_mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  int a, b, n;
  cinall(a, b, n);
  prep();
  long long nways = 0;
  for (int i = 0; i <= n; ++i) {
    int sum = (a * i) + (b * (n - i));
    if (onlyab(sum, a, b)) {
      nways = (((nways) % (c_mod)) + ((ncr(n, i)) % (c_mod))) % c_mod;
    }
  }
  cout << nways;
  return 0;
}
