#include <bits/stdc++.h>
using namespace std;
int a, b, n;
long long mod = 1000000007;
vector<long long> factorial(1000005);
bool excellent(long long z) {
  while (z != 0) {
    if (z % 10 != a && z % 10 != b) return false;
    z /= 10;
  }
  return true;
}
long long pow(long long a, long long p) {
  if (p == 0) return 1;
  if (p % 2 == 1) return (a * pow(a, p - 1)) % mod;
  long long v = pow(a, p >> 1);
  return (v * v) % mod;
}
int calc(int n, int m) {
  return (factorial[n] * (pow(factorial[m], mod - 2) % mod) % mod *
          (pow(factorial[n - m], mod - 2) % mod) % mod);
}
int main() {
  cin >> a >> b >> n;
  factorial[1] = 1;
  for (int i = 2; i <= n; i++) factorial[i] = (factorial[i - 1] * i) % mod;
  long long count = 0;
  for (int i = 0; i <= n; i++) {
    if (excellent(a * i + b * (n - i))) {
      if (n - i != 0 && i != 0) {
        count += calc(n, i);
        count = count % mod;
      } else
        count++;
    }
  }
  cout << count << endl;
  return 0;
}
