#include <bits/stdc++.h>
using namespace std;
const inline int __GET_INT() {
  int ret;
  scanf("%d", &ret);
  return ret;
}
const int mod = 1000000007;
long long fact[10000000];
bool good(int n, int a, int b) {
  int m;
  while (n) {
    m = n % 10;
    if (m != a && m != b) return false;
    n /= 10;
  }
  return true;
}
long long base;
long long inv(int p) {
  if (!p) return 1;
  long long ret = inv(p / 2);
  ret = (ret * ret) % mod;
  if (p & 1) ret = (ret * base) % mod;
  return ret;
}
int ways(int n, int r) {
  base = (fact[r] * fact[n - r]) % mod;
  base = inv(mod - 2);
  return (fact[n] * base) % mod;
}
int main() {
  int a = __GET_INT(), b = __GET_INT(), n = __GET_INT();
  fact[0] = 1;
  for (int i = 1; i < 10000000; ++i) fact[i] = (fact[i - 1] * i) % mod;
  long long res = 0;
  for (int i = 0; i <= n; ++i) {
    int sum = i * a + (n - i) * b;
    if (!good(sum, a, b)) continue;
    res += ways(n, i);
  }
  res %= mod;
  cout << res << endl;
  return 0;
}
