#include <bits/stdc++.h>
using namespace std;
long long a, b, n;
long long modpow(long long a, long long b) {
  if (b == 1) return a;
  long long m = modpow(a, b / 2);
  m = (m * m) % 1000000007LL;
  if (b % 2 == 0)
    return m;
  else
    return (m * a) % 1000000007LL;
}
long long modinv(long long x) { return modpow(x, 1000000007LL - 2); }
bool good(long long sum) {
  while (sum > 0) {
    if ((sum % 10) != a && (sum % 10) != b) return false;
    sum /= 10;
  }
  return true;
}
long long f[1000005];
int main() {
  long long ret = 0;
  scanf("%lld %lld %lld", &a, &b, &n);
  f[0] = 1;
  f[1] = 1;
  for (long long i = 2; i <= n; i++) {
    f[i] = (f[i - 1] * i) % 1000000007LL;
  }
  for (long long acnt = 0; acnt <= n; acnt++) {
    long long sum = acnt * a + (n - acnt) * b;
    if (good(sum)) {
      ret += (f[n] * modinv((f[acnt] * f[n - acnt]) % 1000000007LL)) %
             1000000007LL;
      ret %= 1000000007LL;
    }
  }
  printf("%d\n", (int)ret);
  return 0;
}
