#include <bits/stdc++.h>
using namespace std;
bool check(int a, int b, int n) {
  while (n != 0) {
    int remainder = n % 10;
    if (remainder != a && remainder != b) return false;
    n /= 10;
  }
  return true;
}
int factorial(int n) {
  static bool calc = false;
  static long long fact[1000001] = {};
  if (!calc) {
    calc = true;
    fact[0] = 1;
    for (int i = 1; i != 1000001; ++i) fact[i] = (i * fact[i - 1]) % 1000000007;
  }
  return fact[n];
}
long long gcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long g = gcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return g;
}
long long modInverse(long long a, long long p) {
  long long inverse, y;
  gcd(a, p, inverse, y) != 1;
  return (inverse + p) % p;
}
long long combinatorial(int n, int a) {
  return ((factorial(n) * modInverse(factorial(a), 1000000007)) % 1000000007 *
          modInverse(factorial(n - a), 1000000007)) %
         1000000007;
}
int main() {
  int a, b;
  int n;
  cin >> a >> b >> n;
  long long count = 0;
  for (int i = 0; i <= n; ++i) {
    if (check(a, b, a * i + b * (n - i)))
      count = (count + combinatorial(n, i)) % 1000000007;
  }
  cout << count << '\n';
  return 0;
}
