#include <bits/stdc++.h>
using namespace std;
const int mx = 1234567;
const double eps = 1e-6;
const int md = 1e9 + 7;
const long long M = 1000000007;
const double pi = acos(-1.0);
int dr[8] = {-1, -1, +0, +1, +1, +1, +0, -1};
int dc[8] = {+0, -1, -1, -1, +0, +1, +1, +1};
int ar[mx], xar[mx], uses[mx];
long long arr[mx];
int tab[1000][1000];
string st[1000];
map<int, int> mpii;
map<int, char> mpic;
map<char, int> mpci;
pair<int, int> pr[mx];
int ar1[mx], ar2[mx], ar3[mx], ar4[mx];
long long Ncr[100];
long long BigMod(long long x, long long y) {
  long long res = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % M;
    }
    y = y >> 1;
    x = (x * x) % M;
  }
  return res % M;
}
long long invMod(long long x, long long p) { return BigMod(x, p - 2); }
long long C[1005][1005];
long long inv[1000005], f1[1000005], f2[1000005];
void pascal(long long N) {
  C[0][0] = 1;
  for (long long n = 1; n <= N; n++) {
    C[n][0] = C[n][n] = 1;
    for (long long k = 1; k < n; k++) {
      C[n][k] = C[n - 1][k - 1] + C[n - 1][k];
    }
  }
}
long long ncr(int n, int r) {
  memset(Ncr, 0LL, sizeof(Ncr));
  Ncr[0] = 1LL;
  for (int i = 1; i <= n; i++) {
    for (int j = min(i, r); j > 0; j--) {
      Ncr[j] = Ncr[j] + Ncr[j - 1];
    }
  }
  return Ncr[r];
}
long long ncr_value(int n, int k) {
  double res = 1.0;
  if (k > n - k) k = n - k;
  for (int i = 0; i < k; ++i) {
    res *= (double)(n - i);
    res /= (double)(i + 1);
  }
  return (long long)(res + 0.01);
}
long long ncr_mod(int n, int r) { return f1[n] * f2[r] % M * f2[n - r] % M; }
void ncr_lucas() {}
bool check(long long sum, int a, int b) {
  while (sum > 0) {
    if (sum % 10 == a || sum % 10 == b) {
      sum = sum / 10;
      continue;
    } else
      return false;
  }
  return true;
}
int main() {
  int tk = 1, n, m;
  string s;
  long long x, p, q;
  inv[1] = 1;
  for (int i = 2; i < 1000005; i++) {
    inv[i] = (M - (M / i) * inv[M % i] % M) % M;
  }
  f1[0] = 1;
  for (int i = 1; i < 1000005; i++) {
    f1[i] = f1[i - 1] * (long long)i % M;
  }
  f2[0] = f2[0] = 1;
  for (int i = 1; i < 1000005; i++) {
    f2[i] = f2[i - 1] * inv[i] % M;
  }
  int a, b, c, r;
  while (scanf("%d%d%d", &a, &b, &n) == 3) {
    cerr << "CKECK>>" << endl;
    long long N;
    long long ans = 0;
    for (int i = 0; i <= n; i++) {
      N = (long long)a * i + (long long)b * (n - i);
      if (check(N, a, b)) {
        ans += ncr_mod(n, i) % M;
      }
    }
    cout << ans % M << endl;
  }
  return 0;
}
