#include <bits/stdc++.h>
using namespace std;
int const N = (int)2e6 + 1, INF = (int)1e9 + 1, MOD = (int)1e9 + 7;
long long mypow(long long a, long long b, int mod) {
  long long rv = 1;
  while (b) {
    if (b % 2) rv = rv * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return rv;
}
bool ok, used[N], same;
long long n, m, k, ans, cur, p, cnt, pos;
long long a, b, first[N];
string second, t;
int C(long long n, long long k) {
  return ((first[n] * mypow(first[k], MOD - 2, MOD)) % MOD *
          mypow(first[n - k], MOD - 2, MOD)) %
         MOD;
}
bool check(long long x) {
  while (x != 0) {
    if (x % 10 == a || x % 10 == b) {
      x /= 10;
      continue;
    }
    return false;
  }
  return true;
}
int main() {
  cin >> a >> b >> n;
  first[0] = 1;
  for (int i = 1; i <= n; i++) {
    first[i] = i * first[i - 1];
    first[i] %= MOD;
  }
  for (int i = 0; i <= n; i++) {
    long long x = (n - i) * a + i * b;
    if (check(x)) {
      ans += C(n, i);
      ans %= MOD;
    }
  }
  cout << ans;
  return 0;
}
