#include <bits/stdc++.h>
using namespace std;
long long pow(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % c;
    a = (a * a) % c;
    b >>= 1;
  }
  return ans;
}
long long mod_inv(long long a, long long p) { return pow(a, p - 2, p); }
long long F[1000000 + 4], FP[1000000 + 4];
bool ok(long long s, int a, int b) {
  while (s) {
    int d = s % 10;
    s /= 10;
    if (d != a && d != b) return 0;
  }
  return 1;
}
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  F[0] = 1;
  for (int i = 1; i <= 1000000; i++) F[i] = (F[i - 1] * i) % 1000000007LL;
  FP[1000000] = mod_inv(F[1000000], 1000000007LL);
  for (int i = 1000000 - 1; i >= 0; --i)
    FP[i] = ((long long)FP[i + 1] * (i + 1)) % 1000000007LL;
  long long ans = 0;
  for (int i = 0; i < n + 1; ++i) {
    long long sum = i * a + (n - i) * b;
    long long j = n - i, val = 0;
    if (ok(sum, a, b)) {
      val = (((F[n] * FP[i]) % 1000000007LL) * FP[j]) % 1000000007LL;
    }
    ans += val;
    if (ans >= 1000000007LL) ans -= 1000000007LL;
  }
  cout << ans << endl;
}
