#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
int a, b, C[maxn];
bool is_good(int n) {
  while (n > 0) {
    if (n % 10 != a && n % 10 != b) return false;
    n /= 10;
  }
  return true;
}
int wop(int x, int y) {
  if (y == 0) return 1;
  int res = wop(x, y / 2);
  return (long long)res * res % mod * (y % 2 == 0 ? 1 : x) % mod;
}
int main() {
  int n;
  cin >> a >> b >> n;
  C[0] = 1;
  for (int i = 1; i <= n; ++i)
    C[i] = (long long)C[i - 1] * wop(i, mod - 2) % mod * (n - i + 1) % mod;
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    int sum = i * a + (n - i) * b;
    if (is_good(sum)) ans = (ans + C[i]) % mod;
  }
  cout << ans << '\n';
  return 0;
}
