#include <bits/stdc++.h>
using namespace std;
template <class T>
T max3(T a, T b, T c) {
  return max(a, max(b, c));
}
long long N = 1e6 + 2;
vector<long long> factorials(N, 0);
void precompute() {
  factorials[0] = 1;
  for (long long i = 1; i < N; i++) {
    factorials[i] = (factorials[i - 1] * i) % 1000000007;
  }
}
long long a, b, n;
bool isvalid(string p) {
  long long len = p.size();
  for (long long i = 0; i < len; i++) {
    if ((p[i] - '0') != a && (p[i] - '0') != b) return false;
  }
  return true;
}
long long fermat(long long val, long long mm) {
  if (val == 0) return 1;
  long long ans = 1;
  while (mm > 0) {
    if (mm & 1) {
      ans = (ans * val) % 1000000007;
    }
    val = (val * val) % 1000000007;
    mm >>= 1;
  }
  return ans;
}
void solve() {
  cin >> a >> b >> n;
  vector<pair<long long, long long>> v;
  for (long long i = 0; i <= n; i++) {
    long long temp1 = a * i;
    long long temp2 = b * (n - i);
    long long temp3 = temp1 + temp2;
    string p = to_string(temp3);
    if (isvalid(p)) {
      v.push_back({i, n - i});
    }
  }
  long long ans = 0;
  for (auto i : v) {
    long long temp = fermat(factorials[i.first], 1000000007 - 2);
    long long temp1 = fermat(factorials[i.second], 1000000007 - 2);
    long long temp3 = factorials[n];
    ans = (ans + (temp * temp3) % 1000000007 * temp1) % 1000000007;
  }
  cout << ans << '\n';
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  precompute();
  solve();
  return 0;
}
