#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
long long fact[1000001];
void f() {
  fact[0] = 1;
  fact[1] = 1;
  for (long long i = 2; i <= 1000000; i++) {
    fact[i] = ((i % m) * (fact[i - 1] % m)) % m;
  }
}
bool good(long long a, long long b, long long n) {
  long long f = 0, p = 1, c = 10;
  while (p <= n) {
    if ((n % c) / p != a && (n % c) / p != b) {
      f = 1;
      break;
    }
    p = c;
    c *= 10;
  }
  if (f == 1) return false;
  return true;
}
vector<long long> create(long long n, long long a, long long b) {
  vector<long long> v;
  for (long long i = 0; i <= n; i++) {
    if (good(a, b, a * i + (n - i) * b)) v.push_back(i);
  }
  return v;
}
long long pow(long long a, long long p) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long t = pow(a, p / 2);
    return ((t % m) * (t % m)) % m;
  }
  return (a % m * pow(a, p - 1) % m) % m;
}
int main() {
  long long n, a, b, i, j, t;
  cin >> a >> b >> n;
  vector<long long> v;
  v = create(n, a, b);
  f();
  long long ans = 0;
  for (i = 0; i < v.size(); i++) {
    ans =
        (ans % m +
         ((fact[n] % m) * pow((fact[v[i]] * fact[n - v[i]]), m - 2) % m) % m) %
        m;
  }
  cout << ans << endl;
}
