#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<int> > VVI;
typedef priority_queue<int> PQ;
inline bool good(long long int a, long long int b, long long int sum) {
  while (sum) {
    if (sum % 10 != a && sum % 10 != b) return 0;
    sum /= 10;
  }
  return 1;
}
inline long long int BigMod(long long int a, long long int e,
                            long long int mod) {
  long long int num = 1;
  while (e) {
    if (e % 2) {
      a %= mod;
      num %= mod;
      num = num * a;
      num %= mod;
    }
    e /= 2;
    a %= mod;
    a = a * a;
    a %= mod;
  }
  return num % mod;
}
inline long long int modInverse(long long int A, long long int P) {
  return BigMod(A, P - 2, P);
}
long long int fac[1000007];
inline void factorial(int n, int mod) {
  fac[0] = 1;
  fac[1] = 1;
  for (int i = 2; i <= 1000007; i++) fac[i] = ((fac[i - 1] % mod) * i) % mod;
}
inline int nCr(int n, int r, int mod) {
  return ((fac[n] * modInverse(fac[r], mod) % mod) % mod *
          (modInverse(fac[n - r], mod) % mod)) %
         mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  factorial(1000007, 1000000007);
  long long int a, b, n, ans = 0;
  cin >> a >> b >> n;
  for (int i = 0; i <= n; i++) {
    long long int sum = a * i + (n - i) * b;
    long long int sum2 = b * i + (n - i) * a;
    if (good(a, b, sum)) {
      if (i == n)
        ans = (ans % 1000000007 + 1) % 1000000007;
      else
        ans = (ans % 1000000007 +
               nCr(n, min(i * 1ll, n - i * 1ll), 1000000007) % 1000000007) %
              1000000007;
    }
  }
  cout << ans % 1000000007;
  return 0;
}
