#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
bool mark[9000009];
long long fact[1000009];
long long power(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
int main() {
  fact[0] = 1;
  for (long long i = 1; i <= 1000005; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
  }
  int a, b, n;
  scanf("%d%d%d", &a, &b, &n);
  long long maxVal = 9 * n;
  queue<int> Q;
  Q.push(a);
  Q.push(b);
  while (!Q.empty()) {
    int x = Q.front();
    mark[x] = 1;
    Q.pop();
    int y1 = x * 10 + a, y2 = x * 10 + b;
    if (y1 <= maxVal) Q.push(y1);
    if (y2 <= maxVal) Q.push(y2);
  }
  long long ans = 0;
  for (long long i = 0; i <= n; i++) {
    if (mark[i * a + (n - i) * b]) {
      long long val = (fact[i] * fact[n - i]) % mod;
      val = power(val, mod - 2);
      val = (val * fact[n]) % mod;
      ans = (ans + val) % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
