#include <bits/stdc++.h>
long long bigmod(long long p, long long e, long long M) {
  if (e == 0) return 1;
  if (e % 2 == 0) {
    long long t = bigmod(p, e / 2, M);
    return (t * t) % M;
  }
  return (bigmod(p, e - 1, M) * p) % M;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modinverse(long long a, long long M) { return bigmod(a, M - 2, M); }
using namespace std;
int a, b;
bool check(long n) {
  while (n != 0) {
    int tmp = n % 10;
    if (tmp != a && tmp != b) return false;
    n = n / 10;
  }
  return true;
}
long long fact[1000001];
int main() {
  int i, j, k;
  int n;
  fact[0] = 1;
  for (i = 1; i < 1000001; i++) fact[i] = (i * fact[i - 1]) % 1000000007;
  cin >> a >> b >> n;
  long long total = 0;
  for (i = 0; i <= n; i++) {
    long sum = i * a + (n - i) * b;
    if (check(sum)) {
      total += ((((fact[n] % 1000000007) * (modinverse(fact[i], 1000000007))) %
                 1000000007) *
                (modinverse(fact[n - i], 1000000007))) %
               1000000007;
      total = total % 1000000007;
    }
  }
  cout << total << endl;
  return 0;
}
