#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
long long power(long long a, long long n, long long m) {
  if (n == 0) return 1;
  long long p = power(a, n >> 1, m);
  p = (p * p) % m;
  if (n & 1) p = (p * a) % m;
  return p;
}
long long fact[N], ifact[N];
void calculateFact() {
  fact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = (i * fact[i - 1]) % MOD;
  }
  ifact[N - 1] = power(fact[N - 1], MOD - 2, MOD);
  for (int i = N - 1; i >= 1; i--) {
    ifact[i - 1] = (i * ifact[i]) % MOD;
  }
}
long long nck(int n, int k) {
  if (n < k || k < 0) return 0;
  long long ans = fact[n];
  ans = (ans * ifact[k]) % MOD;
  ans = (ans * ifact[n - k]) % MOD;
  return ans;
}
int a, b;
vector<int> sums;
void fun(int num, int len) {
  if (num) sums.push_back(num);
  if (len == 7) return;
  fun(num * 10 + a, len + 1);
  fun(num * 10 + b, len + 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  calculateFact();
  int n;
  cin >> a >> b >> n;
  fun(0, 0);
  long long ans = 0;
  for (auto it : sums) {
    int cnt = b * n - it;
    if (cnt < 0 || (cnt % (b - a))) continue;
    cnt /= (b - a);
    ans += nck(n, cnt);
    if (ans >= MOD) ans -= MOD;
  }
  cout << ans << "\n";
  return 0;
}
