#include <bits/stdc++.h>
using namespace std;
const int N = int(1e6) + 5;
long long f[N];
int a, b, n;
void calcf(int n) {
  for (int i = 1; i < n + 1; i++) f[i] = f[i - 1] * i, f[i] %= 1000000007;
}
long long mod_pow(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool check(int i) {
  while (i > 0) {
    int l = i % 10;
    if (l == a || l == b)
      i = i / 10;
    else
      return false;
  }
  return true;
}
long long c(int n, int i) {
  long long res = f[n];
  long long div = f[n - i] * f[i];
  div %= 1000000007;
  div = mod_pow(div, 1000000007 - 2, 1000000007);
  return (res * div) % 1000000007;
}
void solve() {
  f[0] = 1;
  cin >> a >> b >> n;
  calcf(n);
  long long ans = 0;
  for (int i = 0; i < n + 1; i++) {
    int sum = a * i + b * (n - i);
    if (check(sum)) {
      ans += c(n, i);
    }
    ans = ans % 1000000007;
  }
  cout << ans << '\n';
}
int main() {
  solve();
  return 0;
}
