#include <bits/stdc++.h>
using namespace std;
long long q(long long a, long long p, long long mo) {
  long long an = 1;
  while (p > 0) {
    if (p & 1) an = (an * a) % mo;
    p /= 2;
    a = (a * a) % mo;
  }
  return an;
}
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  long long an = 0, p = pow(10, 9) + 7;
  vector<long long> f(n + 1);
  f[0] = 1;
  for (int i = 1; i < n + 1; i++) f[i] = (i * f[i - 1]) % p;
  for (int i = 0; i < n + 1; i++) {
    int s = a * i + b * (n - i);
    string te = to_string(s);
    int fl = 0;
    for (char c : te) {
      if ((c - '0' != a) && (c - '0' != b)) {
        fl = 1;
        break;
      }
    }
    if (fl) continue;
    long long tt =
        (((f[n] * q(f[i], p - 2, p)) % p) * q(f[n - i], p - 2, p)) % p;
    an = (an + tt) % p;
  }
  cout << an << endl;
  return 0;
}
