#include <bits/stdc++.h>
const long long P = 1000000007ll;
using namespace std;
long long fac[1111111], inv[1111111];
int a, b, n, m, i, j, k, t;
long long cnt;
long long ans;
long long pow(long long a, long long b) {
  long long ans = 1, x = a;
  for (; b; b >>= 1) {
    if (b & 1) ans = (ans * (long long)a) % P;
    a = (a * (long long)a) % P;
  }
  return ans;
}
bool check(int x) {
  while (x) {
    if (x % 10 != a && x % 10 != b) return false;
    x /= 10;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> a >> b >> n;
  m = max(a, b) * n;
  fac[0] = 1;
  inv[0] = 1;
  for (i = 1; i <= n; i++)
    fac[i] = (fac[i - 1] * i) % P, inv[i] = pow(fac[i], P - 2);
  for (i = 0; i <= n; i++) {
    long long sum = i * a + (n - i) * b;
    long long delta = fac[n];
    delta = (delta * inv[i]) % P;
    delta = (delta * inv[n - i]) % P;
    if (check(sum)) ans = (ans + delta) % P;
  }
  cout << ans << endl;
}
