#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll mod1 = 998244353;
ll fact[(int)1e6 + 5];
ll modpow(ll a, ll b, ll c) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % c;
    }
    a = (a * a) % c;
    b >>= 1;
  }
  return res;
}
ll modinv(ll m, ll n) { return modpow(m, n - 2, n); }
bool good(ll a, ll b, ll sum) {
  while (sum) {
    if (sum % 10 != a && sum % 10 != b) {
      return false;
    }
    sum /= 10;
  }
  return true;
  ;
}
long long getC(ll n, ll i) {
  long long res = fact[n];
  long long div = fact[n - i] * fact[i];
  div %= mod;
  div = modpow(div, mod - 2, mod);
  return (res * div) % mod;
}
int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  ll c[10], ans = 0;
  fact[0] = 1;
  for (int i = 1; i < 1000005; i++) {
    fact[i] = fact[i - 1] * i % mod;
  }
  for (ll i = 0; i < n + 1; i++) {
    ll sum = a * i + b * (n - i);
    if (good(a, b, sum)) {
      ans += getC(n, i);
      ans %= mod;
    }
  }
  cout << ans << endl;
}
