#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void see(T&... args) {
  ((cin >> args), ...);
}
template <typename... T>
void put(T&&... args) {
  ((cout << args << " "), ...);
}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
const long long inf = INT_MAX;
const long double ep = 0.0000001;
const long double pi = acos(-1.0);
const long long md = 1000000007;
long long f[1000005], r[1000005];
long long modexp(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
void solve() {
  long long a, b, n, c = 0;
  f[0] = 1, f[1] = 1, r[0] = 1, r[1] = 1;
  see(a, b, n);
  for (long long i = 2; i < n + 1; ++i) {
    f[i] = i * f[i - 1];
    f[i] %= md;
  }
  for (long long i = 2; i < n + 1; ++i) {
    r[i] = modexp(f[i], md - 2, md);
  }
  for (long long i = 0; i < n + 1; ++i) {
    long long x = a * i + b * (n - i);
    while (x > 0) {
      long long r = x % 10;
      if (r != a && r != b) break;
      x /= 10;
    }
    if (!x) {
      c += (f[n] * r[i] % md) * r[n - i] % md;
      c %= md;
    }
  }
  cout << c;
}
signed main() {
  ios_base::sync_with_stdio(false);
  long long t = 1;
  while (t--) {
    solve();
  }
}
