#include <bits/stdc++.h>
using namespace std;
int n, A, B;
long long F[1000005], FP[1000005];
bool f(long long x) {
  while (x > 0) {
    if (x % 10 != A && x % 10 != B) return 0;
    x /= 10;
  }
  return 1;
}
long long pow(long long numa, long long numb, long long numc) {
  long long numx = 1, numy = numa;
  while (numb > 0) {
    if (numb & 1) numx = (numx * numy) % numc;
    numy = (numy * numy) % numc;
    numb >>= 1;
  }
  return numx;
}
long long modular_inverse(long long numa, long long mod) {
  return pow(numa, mod - 2, mod);
}
void init() {
  F[0] = 1;
  for (int i = 1; i < 1000005; ++i) F[i] = i * F[i - 1], F[i] %= 1000000007;
  FP[1000005 - 1] = modular_inverse(F[1000005 - 1], 1000000007);
  for (int i = 1000005 - 2; i >= 0; --i)
    FP[i] = FP[i + 1] * (i + 1), FP[i] %= 1000000007;
}
int main() {
  init();
  while (cin >> A >> B >> n) {
    long long cnt = 0;
    for (int i = 0; i <= n; ++i)
      if (f(i * A + (n - i) * B)) {
        long long num = F[n], den = FP[i] * FP[n - i];
        den %= 1000000007;
        num *= den;
        num %= 1000000007;
        cnt += num;
        cnt %= 1000000007;
      }
    cout << cnt << endl;
  }
}
