#include <bits/stdc++.h>
using namespace std;
long long int a, b, n, sum, ans = 0, m = 1e9 + 7;
vector<long long int> factorial(1e6 + 6, 1);
void precompute(void) {
  for (int i = 2; i <= 1e6 + 6; ++i) {
    factorial[i] = (factorial[i - 1] * i) % m;
  }
}
long long int inv(long long int a, long long int p) {
  long long int res = 1;
  while (p > 0) {
    if (p & 1) {
      res *= a;
      res %= m;
    }
    a *= a;
    a %= m;
    p >>= 1;
  }
  return res;
}
long long int nCr(int i) {
  long long int res = factorial[n];
  res = (res * inv(factorial[i], m - 2)) % m;
  res = (res * inv(factorial[n - i], m - 2)) % m;
  return res;
}
bool solve(void) {
  int d;
  while (sum > 0) {
    d = sum % 10;
    sum /= 10;
    if ((d != a) and (d != b)) {
      return false;
    }
  }
  return true;
}
int main(void) {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  precompute();
  cin >> a >> b >> n;
  for (int i = 0; i <= n; ++i) {
    sum = i * a + (n - i) * b;
    if (solve()) {
      ans += nCr(i);
      ans %= m;
    }
  }
  cout << ans << "\n";
  return 0;
}
