#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const long long mxn = 1e6 + 10;
long long fact[mxn];
long long power(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    n >>= 1;
  }
  return res;
}
bool excellent(long long sum, long long a, long long b) {
  bool ok = 1;
  while (sum != 0) {
    if ((sum % 10) != a and (sum % 10) != b) return false;
    sum /= 10;
  }
  return 1;
}
long long nCr(long long n, long long r) {
  long long res = fact[n];
  res = (res * power(fact[r], 1000000007 - 2) % 1000000007) % 1000000007;
  res = (res * power(fact[n - r], 1000000007 - 2) % 1000000007) % 1000000007;
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fact[0] = 1;
  for (long long i = 1; i < mxn; i++) fact[i] = (fact[i - 1] * i) % 1000000007;
  long long a, b, n;
  cin >> a >> b >> n;
  long long ans = 0;
  for (long long i = 0; i <= n; i++) {
    long long sum = i * a + (n - i) * b;
    if (excellent(sum, a, b)) {
      ans = (ans + nCr(n, i)) % 1000000007;
    }
  }
  cout << ans << "\n";
  return 0;
}
