#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
const int mod = 1000000007;
long long modpow(long long a, long long n, long long mod) {
  long long b = 1;
  while (n > 0) {
    if (n & 1) b = (long long)b * a % mod;
    n >>= 1;
    a = (long long)a * a % mod;
  }
  return b;
}
long long fact[1000009], rev[1000009];
long long C(int n, int k) { return fact[n] * rev[k] % mod * rev[n - k] % mod; }
int L[1111];
int main() {
  int i;
  fact[0] = 1;
  for (i = 1; i < 1000009; i++) fact[i] = fact[i - 1] * i % mod;
  for (i = 0; i < 1000009; i++) rev[i] = modpow(fact[i], mod - 2, mod);
  int a, b, n;
  cin >> a >> b >> n;
  int sz = 0;
  for (int len = 1; len <= 7; len++) {
    for (int mask = 0; mask < (1 << len); mask++) {
      int v = 0;
      for (i = 0; i < len; i++) {
        v *= 10;
        v += (mask & (1 << i)) ? a : b;
      }
      L[sz++] = v;
    }
  }
  sort(L, L + sz);
  long long res = 0;
  for (i = 0; i <= n; i++) {
    int j = n - i;
    if (binary_search(L, L + sz, i * a + j * b)) res = (res + C(n, i)) % mod;
  }
  cout << res << endl;
}
