#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long bigmod(long long n, long long power, long long mod) {
  if (!power) return 1;
  if (power % 2 == 0) {
    long long ret = bigmod(n, power / 2, mod);
    return ((ret % mod) * (ret % mod)) % mod;
  } else
    return ((n % mod) * (bigmod(n, power - 1, mod) % mod)) % mod;
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res *= x;
    x *= x;
    y >>= 1;
  }
  return res;
}
long long n, cnt, num, res, mod(1e9 + 7), a, b, arr[1000002];
bool ok;
long long comb(long long x) {
  return (arr[n] *
          ((bigmod(arr[x], mod - 2, mod) * bigmod(arr[n - x], mod - 2, mod)) %
           mod)) %
         mod;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  arr[0] = 1;
  for (int i = 1; i <= 1e6; i++) arr[i] = (arr[i - 1] * i) % mod;
  cin >> a >> b >> n;
  for (int i = 0; i <= n; i++) {
    num = ((i * a) + ((n - i) * b));
    ok = true;
    while (num) {
      if (num % 10 != a && num % 10 != b) {
        ok = false;
        break;
      }
      num /= 10;
    }
    if (ok) cnt += comb(i), cnt %= mod;
  }
  cout << cnt << "\n";
  cin >> n;
  return 0;
}
