#include <bits/stdc++.h>
using namespace std;
long long fact[1000006];
long long power(long long b, long long p) {
  long long k = 1;
  while (p != 0) {
    if (p % 2 == 1) k = (k * b) % 1000000007;
    b = (b * b) % 1000000007;
    p /= 2;
  }
  return k;
}
bool comp(long long num, long long a, long long b) {
  while (num != 0) {
    if (num % 10 != a && num % 10 != b) return false;
    num /= 10;
  }
  return true;
}
int main() {
  long long i, j, a, b, c, n, m, k, res;
  fact[0] = 1;
  for (i = 1; i <= 1000003; i++) fact[i] = (fact[i - 1] * i) % 1000000007;
  while (scanf("%I64d %I64d %I64d", &a, &b, &n) == 3) {
    res = 0;
    for (i = 0, j = n; i <= n && j >= 0; i++, j--) {
      m = a * i + b * j;
      c = comp(m, a, b);
      if (c == 1) {
        k = fact[n];
        k = (k * power(fact[i], 1000000007 - 2)) % 1000000007;
        k = (k * power(fact[j], 1000000007 - 2)) % 1000000007;
        res = (res + k) % 1000000007;
      }
    }
    res %= 1000000007;
    printf("%I64d\n", res);
  }
  return 0;
}
