#include <bits/stdc++.h>
using namespace std;
long long fl[1000001], fac[1000001], inv[1000001];
void init() {
  fl[0] = 1;
  fl[1] = 1;
  fac[0] = 1;
  fac[1] = 1;
  inv[0] = 1;
  inv[1] = 1;
  int i;
  for (i = 2; i <= 1000000; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    fl[i] = (1000000007 - 1000000007 / i) * fl[1000000007 % i] % 1000000007;
    inv[i] = inv[i - 1] * fl[i] % 1000000007;
  }
}
long long C(long long x, long long y) {
  return fac[x] * inv[y] % 1000000007 * inv[x - y] % 1000000007;
}
long long pgood(long long x, long long a, long long b) {
  while (x > 0) {
    if ((x % 10) != a && (x % 10) != b) return 0;
    x /= 10;
  }
  return 1;
}
int main() {
  long long a, b, n;
  init();
  cin >> a >> b >> n;
  long long i, h = b * n, ans = 0;
  if (pgood(h, a, b)) ans += 1;
  for (i = 1; i <= n; i++) {
    h -= b;
    h += a;
    if (pgood(h, a, b)) ans = (ans + (C(n, i) % 1000000007)) % 1000000007;
  }
  cout << ans % 1000000007;
  return 0;
}
