#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T distsqr(T x, T y, T a, T b) {
  return sqr(x - a) + sqr(y - b);
}
double cosine_angle(double a, double b, double c) {
  return (double)(sqr(a) + sqr(b) - sqr(c)) / ((double)2.0 * a * b);
}
template <class T>
T Maximum(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T Minimum(T a, T b) {
  return a < b ? a : b;
}
template <class T>
T GCD(T a, T b) {
  if (!b) return a;
  return GCD(b, a % b);
}
template <class T>
void SWAP(T &a, T &b) {
  T temp = a;
  a = b;
  b = temp;
  return;
}
template <class T>
T sign(T a) {
  return a < 0 ? -1 : 1;
}
template <class T>
T BigMod(T a, T n, T mod) {
  if (!n) return (T)1 % mod;
  long long int power = BigMod(a, n >> 1, mod);
  power %= mod;
  power *= power;
  power %= mod;
  if (n & 1) power *= a % mod, power %= mod;
  return power;
}
template <class T>
T ExtendedEuclid(T a, T b, T c) {
  if (!a) return 0;
  return (b * ExtendedEuclid(b % a, a, -c) + c) / a;
}
template <class T>
T ModInverse(T a, T m) {
  return ((ExtendedEuclid(a, m, (T)GCD(a, m))) % (m) + (m)) % (m);
}
int n, taken[10], digit[2];
long long int factorial[1000010], invfactorial[1000010];
long long int counts;
void Processing() {
  int i;
  for (i = 1, factorial[i - 1] = invfactorial[i - 1] = 1; i < 1000010; i++)
    factorial[i] = i * factorial[i - 1], factorial[i] %= 1000000007;
  return;
}
long long int nCr(int n, int r) {
  long long int val = factorial[n];
  val %= 1000000007;
  val *= ModInverse(factorial[r], (long long int)1000000007);
  val %= 1000000007;
  val *= ModInverse(factorial[n - r], (long long int)1000000007);
  val %= 1000000007;
  return val;
}
void F(int i, int level) {
  if (i == level) {
    int sum;
    for (i = sum = 0; i < level; i++) {
      sum *= 10;
      sum += taken[i];
    }
    sum -= n * digit[0];
    if (sum % (digit[1] - digit[0]) || sum < 0)
      ;
    else {
      sum /= digit[1] - digit[0];
      if (sum < n + 1) counts += nCr(n, sum), counts %= 1000000007;
    }
    return;
  }
  int j;
  for (j = 0; j < 2; j++) {
    taken[i] = digit[j];
    F(i + 1, level);
  }
  return;
}
int Digit(int n) { return (int)(log10(n) + 1e-12) + 1; }
long long int Solving() {
  counts = 0;
  int i, a = Digit(digit[0] * n), b = Digit(digit[1] * n);
  for (i = a; i < b + 1; i++) F(0, i);
  return counts;
}
int main() {
  Processing();
  scanf("%d %d %d", digit, digit + 1, &n);
  printf("%lld\n", Solving());
  return 0;
}
