#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e6 + 10;
const int MAXN = 1e3 + 1;
const long long INF = 1e9 + 7;
const long long BINF = 1e16;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
long long a, b, n;
long long ans;
long long pref[MXN];
long long binpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    long long x = binpow(a, n / 2) % MOD;
    return (x * x) % MOD;
  } else {
    return ((binpow(a, n - 1) % MOD) * a) % MOD;
  }
}
int main() {
  cin >> a >> b >> n;
  pref[0] = 1;
  for (long long i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] * i, pref[i] %= MOD;
  }
  for (long long i = 0; i <= n; i++) {
    long long x = i * a + (n - i) * b;
    bool q = 1;
    while (x != 0) {
      if (!(x % 10 == a || x % 10 == b)) {
        q = 0;
      }
      x /= 10;
    }
    if (q) {
      long long sum = (pref[n - i] * pref[i]) % MOD;
      ans += (pref[n] * binpow(sum, MOD - 2)) % MOD;
      ans %= MOD;
    }
  }
  cout << ans;
  return 0;
}
