#include <bits/stdc++.h>
using namespace std;
vector<long long> fact(1000006, 1);
void factorial() {
  long long i = 0;
  fact[0] = 1;
  for (int i = 1; i <= 1000000; i++) {
    fact[i] = (fact[i - 1] % 1000000007 * i % 1000000007) % 1000000007;
  }
}
long long gcd_extended(long long a, long long b, long long& xx, long long& yy) {
  if (a == 0) {
    xx = 0;
    yy = 1;
    return b;
  }
  long long xx1, yy1;
  long long g = gcd_extended(b % a, a, xx1, yy1);
  xx = yy1 - (b / a) * xx1;
  yy = xx1;
  return g;
}
long long divMod(long long x, long long y) {
  long long xx, yy;
  long long g = gcd_extended(y, 1000000007, xx, yy);
  long long p = (xx % 1000000007 + 1000000007) % 1000000007;
  return (x % 1000000007 * p % 1000000007) % 1000000007;
}
int main() {
  long long a, b, n, ans = 0;
  cin >> a >> b >> n;
  factorial();
  for (int i = 0; i <= n; i++) {
    long long sum = a * i + (n - i) * b, flag = 0;
    while (sum > 0) {
      if ((sum % 10) != a && (sum % 10) != b) {
        flag = 1;
        break;
      }
      sum /= 10;
    }
    if (flag == 1) {
      continue;
    }
    long long y = fact[n];
    long long x = fact[i], z = fact[n - i];
    long long w = (x % 1000000007 * z % 1000000007) % 1000000007;
    ans = (ans + divMod(y, w)) % 1000000007;
  }
  cout << ans << endl;
}
