#include <bits/stdc++.h>
using namespace std;
long long f[1000001];
long long pow1(long long a, long long b) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > 1000000007) x %= 1000000007;
    }
    y = (y * y);
    if (y > 1000000007) y %= 1000000007;
    b /= 2;
  }
  return x;
}
long long InverseEuler(long long n) { return pow1(n, 1000000007 - 2); }
long long C(long long n, long long r) {
  return (f[n] * ((InverseEuler(f[r]) * InverseEuler(f[n - r])) % 1000000007)) %
         1000000007;
}
int main(int argc, char const *argv[]) {
  std::ios::sync_with_stdio(false);
  int a, b, n;
  cin >> a >> b >> n;
  f[0] = 1;
  long long sum1 = 0;
  for (int i = 1; i <= n; i++) {
    f[i] = (f[i - 1] * i) % 1000000007;
  }
  long long sum = 0;
  int c = 0;
  long long rem;
  int idx[1000001];
  for (int i = 0; i <= n; i++) {
    sum = (a)*i + b * (n - i);
    int flag = -1;
    while (sum != 0) {
      rem = sum % 10;
      if (rem != a && rem != b) {
        flag = 0;
        break;
      }
      sum = sum / 10;
    }
    if (flag == -1) {
      sum1 = (sum1 + C(n, i)) % 1000000007;
    }
    sum = 0;
  }
  cout << sum1 << endl;
  return 0;
}
