#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long mx = 1e6 + 5;
long long fact[mx], revfact[mx];
using namespace std;
long long inverpow(long long osn) {
  long long res = 1, tmp = osn;
  int m = int(mod - 2);
  while (m) {
    if (m % 2) {
      res = (res * tmp) % mod;
      --m;
    }
    m >>= 1;
    tmp = (tmp * tmp) % mod;
  }
  return res;
}
long long C(long long c, long long r) {
  return fact[c] * revfact[r] % mod * revfact[c - r] % mod;
}
void solve() {
  long long a, b, n;
  cin >> a >> b >> n;
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    long long cur = a * (n - i) + b * i;
    bool flag = true;
    while (cur) {
      int c = cur % 10;
      if (c != a && c != b) flag = false;
      cur /= 10;
    }
    if (flag) {
      ans = (ans + C(n, i)) % mod;
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  fact[0] = revfact[0] = 1ll;
  for (long long i = 1; i < mx; i++) {
    fact[i] = fact[i - 1] * i % mod;
    revfact[i] = inverpow(fact[i]);
  }
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
