#include <bits/stdc++.h>
using namespace std;
long long int po(long long int x, long long int n, long long int M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return po((x * x) % M, n / 2, M);
  else
    return (x * po((x * x) % M, (n - 1) / 2, M)) % M;
}
long long D(long long int N, long long int a1, long long int b1) {
  long long x = 0;
  while (N) {
    long long r;
    r = N % 10;
    N = N / 10;
    if (r != a1 && r != b1) {
      x = 1;
      break;
    }
  }
  return x;
}
long long fact[1000005];
int main() {
  long long a1, b1, n2;
  long long k = 0, X = 0;
  cin >> a1 >> b1 >> n2;
  fact[0] = 1;
  for (long long i = 1; i <= n2; i++) fact[i] = (fact[i - 1] * i) % 1000000007;
  for (long long i = n2 * a1; i <= b1 * n2; i = i + b1 - a1) {
    if (D(i, a1, b1) == 0) {
      k = (k + (((fact[n2] * po(fact[X], 1000000007 - 2, 1000000007)) %
                 1000000007) *
                po(fact[n2 - X], 1000000007 - 2, 1000000007)) %
                   1000000007) %
          1000000007;
    }
    X++;
  }
  cout << k;
}
