#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long fact[1100000];
void find_fact() {
  fact[0] = fact[1] = 1;
  for (int i = 2; i <= 1e6; i++) fact[i] = (i * fact[i - 1]) % mod;
}
bool isvalid(long long num, int num1, int num2) {
  while (num > 0) {
    int cval = (num % 10);
    if ((cval != num1) && (cval != num2)) return 0;
    num = (num / 10);
  }
  return 1;
}
long long my_exp(int base, int exp) {
  if (exp == 0) return 1;
  if (exp == 1) return base;
  long long ans = my_exp(base, exp / 2);
  ans = (ans * ans) % mod;
  if (exp % 2) ans = (ans * base) % mod;
  return ans;
}
long long my_comb(int n, int i) {
  return (fact[n] * my_exp((fact[i] * fact[n - i]) % mod, mod - 2)) % mod;
}
int main() {
  find_fact();
  int num1, num2, n;
  cin >> num1 >> num2 >> n;
  long long csm, ans = 0;
  for (int i = 0; i <= n; i++) {
    csm = (i * num1 + (n - i) * num2);
    if (isvalid(csm, num1, num2)) ans = (ans + my_comb(n, i)) % mod;
  }
  cout << ans;
  return 0;
}
