#include <bits/stdc++.h>
using namespace std;
const unsigned long long M = 1e9 + 7;
bool valid(unsigned long long n, unsigned long long a, unsigned long long b) {
  if (n == 0LL) {
    return 0;
  }
  while (n) {
    unsigned long long val = n % 10;
    if (val != a && val != b) {
      return 0;
    }
    n /= 10;
  }
  return 1;
}
unsigned long long bPow(unsigned long long base, unsigned long long p) {
  if (p == 1) {
    return base;
  }
  if (p % 2 == 0) {
    unsigned long long t = bPow(base, p / 2);
    return t * t % M;
  } else {
    return bPow(base, p - 1) * base % M;
  }
}
unsigned long long fact(unsigned long long n) {
  unsigned long long res = 1;
  for (unsigned long long i = 1; i <= n; i++) {
    res *= i;
    res %= M;
  }
  return res;
}
unsigned long long inverse(unsigned long long a) { return bPow(a, M - 2); }
unsigned long long divide(unsigned long long a, unsigned long long b) {
  return a * inverse(b) % M;
}
unsigned long long add(unsigned long long a, unsigned long long b) {
  return (a + b) % M;
}
unsigned long long mul(unsigned long long a, unsigned long long b) {
  return (a * b) % M;
}
int main() {
  unsigned long long a, b, n, c, d;
  vector<pair<unsigned long long, unsigned long long> > cnt;
  cin >> a >> b >> n;
  for (unsigned long long i = 0; i <= n; i++) {
    unsigned long long m = a * i, f = (n - i) * b;
    if (valid(f + m, a, b)) {
      c = i;
      d = n - i;
      cnt.push_back(make_pair(c, d));
    }
  }
  unsigned long long ans = 0LL, tmp = fact(n);
  for (auto x : cnt) {
    c = x.first, d = x.second;
    unsigned long long now = mul(fact(c), fact(d));
    unsigned long long res = divide(tmp, now);
    ans = add(ans, res);
  }
  cout << ans;
  return 0;
}
