#include <bits/stdc++.h>
using namespace std;
const int MAX = 100010;
const int MOD = 1000000007;
const int INF = 1e8;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-7;
int a, b, n;
bool beauty(int v) {
  while (v != 0) {
    if (v % 10 != a and v % 10 != b) return false;
    v /= 10;
  }
  return true;
}
long long fexp(long long b, long long e) {
  if (e == 0) return 1;
  long long res = fexp(b, e / 2);
  res = (res * res) % MOD;
  if (e % 2) res = (res * b) % MOD;
  return res;
}
long long inv(long long a) { return fexp(a, MOD - 2); }
int main() {
  cin >> a >> b >> n;
  long long fact[n + 2], res = 0;
  fact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = (i * fact[i - 1]) % MOD;
  }
  for (int i = 0; i <= n; i++) {
    long long soma = i * a + (n - i) * b;
    if (beauty(soma)) {
      long long tmp = (inv(fact[i]) * inv(fact[n - i])) % MOD;
      tmp = (fact[n] * tmp) % MOD;
      res = (res + tmp) % MOD;
    }
  }
  cout << res << '\n';
  return 0;
}
