#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << "\n";
  err(++it, args...);
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ": " << p.second << ")";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (unsigned int i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {
  bool first = true;
  os << "{";
  for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "}";
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {
  bool first = true;
  os << "{";
  for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "}";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os,
                                const std::unordered_set<T>& v) {
  return os << std::set<T>(v.begin(), v.end());
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os,
                                const std::unordered_map<T1, T2>& v) {
  return os << std::map<T1, T2>(v.begin(), v.end());
}
const long long int MOD = 1e9 + 7;
const long long int INF = 1e18;
const double E = 1e-6;
long long int mpow(long long int base, long long int ex, long long int MOD) {
  long long int res = 1LL;
  while (ex > 0) {
    if (ex & 1) res = (base * res) % MOD;
    base = (base * base) % MOD;
    ex >>= 1;
  }
  return res;
}
long long int mul(long long int a, long long int b) { return a * b % MOD; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int a, b, n;
  cin >> a >> b >> n;
  char ca = '0' + a, cb = '0' + b;
  long long int ans = 0;
  vector<long long int> fac(n + 1), ifac(n + 1);
  fac[0] = 1LL;
  for (long long int i = 1; i <= n; ++i) fac[i] = (i * fac[i - 1]) % MOD;
  ifac[n] = mpow(fac[n], MOD - 2, MOD);
  for (long long int i = n; i > 0; --i) ifac[i - 1] = (i * ifac[i]) % MOD;
  for (long long int i = 0; i <= n; ++i) assert((fac[i] * ifac[i]) % MOD == 1);
  for (int cnta = 0; cnta <= n; cnta++) {
    int sum = a * cnta + b * (n - cnta);
    bool ok = true;
    for (char c : to_string(sum))
      if (c != ca && c != cb) {
        ok = false;
        break;
      }
    if (ok) {
      ans += mul(mul(fac[n], ifac[cnta]), ifac[n - cnta]);
      ans %= MOD;
    }
  }
  cout << ans;
  return 0;
}
