#include <bits/stdc++.h>
using namespace std;
long long int a, b;
long long int fact[1000001];
long long int mod = 1e9 + 7;
bool ckeck(long long int x) {
  while (x > 0) {
    if (x % 10 != a and x % 10 != b) return false;
    x /= 10;
  }
  return true;
}
long long int exponentiation(long long int base, long long int exp) {
  long long int N = mod;
  if (exp == 0) return 1;
  if (exp == 1) return base % N;
  long long int t = exponentiation(base, exp / 2);
  t = (t * t) % N;
  if (exp % 2 == 0)
    return t;
  else
    return ((base % N) * t) % N;
}
long long int C(long long int n, long long int r) {
  long long int x = (fact[r] * fact[n - r]);
  x %= mod;
  x = exponentiation(x, mod - 2);
  return (fact[n] * x) % mod;
}
int main() {
  long long int i, j, n, m, k;
  cin >> a >> b >> n;
  long long int s = n * a;
  fact[0] = 1;
  for (i = 1; i <= n; i++) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= mod;
  }
  long long int ans = 0;
  if (ckeck(s)) {
    ans += C(n, 0);
    ans %= mod;
  }
  for (i = 1; i <= n; i++) {
    s -= a;
    s += b;
    if (ckeck(s)) {
      ans += C(n, i);
      ans %= mod;
    }
  }
  cout << ans;
}
