#include <bits/stdc++.h>
static inline int min(int a, int b) { return a < b ? a : b; }
static int _sd[254] = {};
static void generate_sd(int a, int b) {
  int sd_count = 0;
  for (int i = 1; i <= 7; ++i) {
    for (int j = 0, jn = 1 << i; j < jn; ++j) {
      int n = 0, m = j;
      for (int k = 0, p10 = 1; k < i; ++k, p10 *= 10, m >>= 1)
        n += p10 * (m & 0x1 ? b : a);
      assert(sd_count < 254);
      _sd[sd_count++] = n;
    }
  }
}
static int64_t _fact[1000001];
static inline uint64_t pow_mod(int64_t a, int64_t pow, int64_t mod) {
  if (pow == 0) return 1;
  while (pow % 2 == 0) {
    a = (a * a) % mod;
    pow /= 2;
  }
  int64_t ret = a;
  pow /= 2;
  while (pow) {
    a = (a * a) % mod;
    if (pow % 2 != 0) ret = (ret * a) % mod;
    pow /= 2;
  }
  return ret;
}
static inline int64_t binomial_mod(int n, int k) {
  const int64_t nf = _fact[n], kf = _fact[k], nkf = _fact[n - k],
                denom = (kf * nkf) % 1000000007LL;
  return (nf * pow_mod(denom, 1000000007LL - 2, 1000000007LL)) % 1000000007LL;
}
int main() {
  int A, B, N;
  scanf("%d %d %d\n", &A, &B, &N);
  generate_sd(A, B);
  _fact[0] = 1;
  for (int i = 1; i <= N; ++i) _fact[i] = (i * _fact[i - 1]) % 1000000007LL;
  int64_t count = 0;
  for (int si = 0; si < 254; ++si) {
    const int ss = _sd[si] - A * N;
    if (ss % (B - A) == 0) {
      const int y = ss / (B - A), x = N - y;
      if (x >= 0 && y >= 0) {
        count = (count + binomial_mod(N, y)) % 1000000007LL;
      }
    }
  }
  printf("%d\n", (int)count);
}
