#include <bits/stdc++.h>
using namespace std;
inline long long add(long long a, long long b) {
  return ((a % 1000000007LL) + (b % 1000000007LL)) % 1000000007LL;
}
inline long long mul(long long a, long long b) {
  return ((a % 1000000007LL) * (b % 1000000007LL)) % 1000000007LL;
}
inline long long sub(long long a, long long b) {
  return ((a % 1000000007LL) - (b % 1000000007LL) + 1000000007LL) %
         1000000007LL;
}
vector<long long> possible;
long long fac[1000000LL + 1];
long long facInv[1000000LL + 1];
long long power(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long modInv(long long x) {
  return power(x, 1000000007LL - 2, 1000000007LL) % 1000000007LL;
}
bool chk(long long x, long long a, long long b) {
  long long temp;
  while (x) {
    temp = (x % 10);
    if (temp != a && temp != b) {
      return false;
    }
    x /= 10;
  }
  return true;
}
void Flash() {
  long long a, b, n;
  cin >> a >> b >> n;
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fac[i] = mul(fac[i - 1], i);
  }
  for (long long i = 0; i <= n; i++) {
    facInv[i] = modInv(fac[i]);
  }
  long long ans = 0, y, r, temp, diff = (b - a);
  for (long long i = 0; i <= n; i++) {
    temp = (a * i + b * (n - i));
    if (!chk(temp, a, b)) {
      continue;
    }
    ans = add(ans, mul(fac[n], mul(facInv[i], facInv[n - i])));
  }
  cout << ans << "\n";
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  ;
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    Flash();
  }
  return 0;
}
