#include <bits/stdc++.h>
using namespace std;
int n;
int mod = 1000000007, a, b;
long long fact[1000100];
long long pw(long long x, long long sum) {
  long long res = 1, power = sum, val = x;
  while (power) {
    if (power & 1) {
      res *= val;
      res %= mod;
    }
    val *= val;
    val %= mod;
    power >>= 1ll;
  }
  return res;
}
bool ok(long long sum) {
  while (sum) {
    if (sum % 10 != a && sum % 10 != b) return 0;
    sum /= 10;
  }
  return 1;
}
int main() {
  scanf("%d%d%d", &a, &b, &n);
  fact[1] = fact[0] = 1;
  for (int i = 2; i <= n; i++) fact[i] = (fact[i - 1] * i) % mod;
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    if (ok(i * a + (n - i) * b))
      ans += fact[n] * pw(fact[i] * fact[n - i] % mod, mod - 2);
    ans %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}
