#include <bits/stdc++.h>
using namespace std;
long long fact[1000010];
long long m = 1e9 + 7;
long long me(long long a, long long b, long long m) {
  long long ans = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      ans = (ans % m * a % m) % m;
    }
    a = (a * a) % m;
    b /= 2;
  }
  return ans % m;
}
bool check(long long x, long long a, long long b) {
  while (x > 0) {
    int dg = x % 10;
    if (dg != a && dg != b) return false;
    x /= 10;
  }
  return true;
}
long long ncr(long long n, long long r) {
  long long fn = fact[n];
  long long tf = fact[r] * fact[n - r];
  tf = tf % m;
  tf = me(tf, m - 2, m);
  fn = (tf % m * fn % m) % m;
  return fn % m;
}
int main() {
  fact[0] = 1;
  for (long long i = 1; i <= 1000001; i++) {
    fact[i] = (fact[i - 1] * i) % m;
  }
  int n, a, b;
  cin >> a >> b >> n;
  if (a == b) {
    if (check(n * a, a, b)) {
      cout << "1\n";
    } else
      cout << "0\n";
    return 0;
  }
  long long ans = 0;
  for (long long i = 0; i <= n; i++) {
    long long tmp = i * a + (n - i) * b;
    if (check(tmp, a, b)) {
      ans += ncr(n, i);
      ans %= m;
    }
  }
  cout << ans << "\n";
  return 0;
}
