#include <bits/stdc++.h>
using namespace std;
vector<int> res;
const int mod = 1e9 + 7;
const int N = 2000010;
int a, b, n;
bool isgood(int n) {
  while (n) {
    if ((n % 10) != a && (n % 10) != b) return false;
    n /= 10;
  }
  return true;
}
long long qsm(int a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = 1ll * a * a % mod;
  }
  return res;
}
long long fact[N], infact[N];
int main() {
  cin >> a >> b >> n;
  for (int i = 0; i <= n; i++)
    if (isgood(i * a + (n - i) * b)) res.push_back(i);
  fact[0] = infact[0] = 1;
  for (int i = 1; i < N; i++)
    fact[i] = fact[i - 1] * i % mod, infact[i] = qsm(fact[i], mod - 2);
  long long ress = 0;
  for (auto x : res) {
    int y = n - x;
    ress = (ress + fact[n] * infact[x] % mod * infact[y] % mod) % mod;
  }
  cout << ress << endl;
  return 0;
}
