#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 50;
const int mod = 1e9 + 7;
long long fi[maxn];
long long arr[maxn];
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return res % mod;
}
long long c(long long n, long long m) {
  long long ans = fi[n] * qpow(fi[m] * fi[n - m] % mod, mod - 2) % mod;
  return ans;
}
int main() {
  long long a = (long long)mod * mod, b, n, cnt = 0;
  cin >> a >> b >> n;
  fi[0] = 1;
  for (int i = 1; i <= n; i++) {
    fi[i] = fi[i - 1] * i % mod;
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    long long t = i * a + (n - i) * b;
    bool flag = true;
    while (t) {
      if (t % 10 != a && t % 10 != b) {
        flag = false;
        break;
      }
      t /= 10;
    }
    if (flag) {
      ans += c(n, i);
      ans %= mod;
    }
  }
  cout << ans;
}
