#include <bits/stdc++.h>
using namespace std;
long long fact[1000001];
long long inv[1000001];
long long a, b, n;
bool check(long long i) {
  long long sum = a * i + (n - i) * b;
  while (sum) {
    if (sum % 10 != a && sum % 10 != b) return 0;
    sum /= 10;
  }
  return 1;
}
long long power(long long nn, long long k) {
  nn %= 1000000007;
  long long rez = 1;
  while (k) {
    if (k & 1) {
      rez = (rez * nn) % 1000000007;
    }
    nn = (nn * nn) % 1000000007;
    k >>= 1;
  }
  return rez;
}
long long nck(long long nn, long long k) {
  long long div = (inv[k] * inv[nn - k]) % 1000000007;
  return (fact[nn] * div) % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b >> n;
  fact[0] = 1;
  inv[0] = power(fact[0], 1000000007 - 2);
  for (long long i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
    inv[i] = power(fact[i], 1000000007 - 2);
  }
  long long rez = 0;
  for (long long i = 0; i <= n; i++) {
    if (check(i)) {
      rez += nck(n, i);
      rez %= 1000000007;
    }
  }
  cout << rez;
  return 0;
}
