#include <bits/stdc++.h>
using namespace std;
const long long N = 1000011, mod = 1e9 + 7;
;
long long binpow(long long x, long long y) {
  if (y == 0) return 1;
  if (y == 1)
    return x % mod;
  else if (y % 2 == 0) {
    long long w = binpow(x, y / 2) % mod;
    return (w * w) % mod;
  } else
    return ((x % mod) * (binpow(x, y - 1) % mod)) % mod;
}
long long ans = 0;
long long a, b, n;
long long fact[N + 17];
long long ext_euclid(long long a, long long x, long long b, long long y) {
  if (b == 0) return x;
  return ext_euclid(b, y, a % b, x - (a / b) * y);
}
long long inv(long long t) {
  return (ext_euclid(mod, 0ll, t, 1ll) + mod) % mod;
}
long long comb(int m, int t) {
  return ((fact[m] * inv(fact[t])) % mod * inv(fact[m - t])) % mod;
}
bool check(long long x) {
  bool bb = true;
  while (x > 0) {
    if (x % 10 != a && x % 10 != b) bb = false;
    x /= 10;
  }
  return bb;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    fact[0] = 1;
    for (int i = 1; i < N; ++i) fact[i] = (fact[i - 1] * i) % mod;
    cin >> a >> b >> n;
    for (long long i = 0; i <= n; i++) {
      if (check(i * a + (n - i) * b)) {
        ans += comb(n, i);
        ans %= mod;
      }
    }
    while (ans < 0) ans += mod;
    cout << ans;
  }
}
