#include <bits/stdc++.h>
using namespace std;
long long A, B, N, T;
long long F[1000005];
bool g(long long n) {
  for (; n > 0 && ((n % 10) == A || (n % 10) == B); n /= 10)
    ;
  return n == 0;
}
long long e(long long n, long long p) {
  return p < 2 ? (p == 0 ? 1 : n)
               : (p % 2 ? (((e(n, p / 2) * e(n, p / 2)) % 1000000007) * n) %
                              1000000007
                        : (e(n, p / 2) * e(n, p / 2)) % 1000000007);
}
int main() {
  cin >> A >> B >> N;
  F[0] = F[1] = 1;
  for (long long i = 2; i <= N; i++) F[i] = (F[i - 1] * i) % 1000000007;
  for (long long a = 0; a <= N; a++)
    if (g(a * A + (N - a) * B))
      T = (T + ((F[N] * e(F[a], 1000000007 - 2) % 1000000007) *
                e(F[N - a], 1000000007 - 2)) %
                   1000000007) %
          1000000007;
  cout << T;
}
