#include <bits/stdc++.h>
using namespace std;
bool check(long long x, long long a, long long b) {
  while (x > 0) {
    long long d = x % 10;
    if (d != a && d != b) return false;
    x /= 10;
  }
  return true;
}
long long fac[2010000 + 1];
long long power(long long x, long long y) {
  long long res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long modInverse(long long n) { return power(n, 1000000007 - 2); }
long long nCrModPFermat(long long n, long long r) {
  if (r == 0) return 1;
  return (fac[n] * modInverse(fac[r]) % 1000000007 * modInverse(fac[n - r]) %
          1000000007) %
         1000000007;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b, n;
  cin >> a >> b >> n;
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % 1000000007;
  long long ans = 0;
  for (long long i = a * n; i <= b * n; i++) {
    if (check(i, a, b)) {
      long long d = (b - a);
      if ((i - a * n) % d == 0) {
        long long m = (i - a * n) / d;
        if (m <= n) ans += (nCrModPFermat(n, m));
        ans %= 1000000007;
      }
    }
  }
  cout << ans % 1000000007 << endl;
}
