#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
long long fact[N], inv[N];
long long fp(long long base, long long exp) {
  if (exp == 0) return 1;
  long long ans = fp(base, exp / 2);
  ans = (ans * ans) % mod;
  if (exp % 2 != 0) ans = (ans * (base % mod)) % mod;
  return ans;
}
void pre(long long n) {
  fact[0] = 1;
  inv[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
    inv[i] = fp(fact[i], mod - 2);
  }
}
int ncr(long long n, long long r) {
  return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;
}
long long a, b, n;
bool check(long long num) {
  while (num) {
    if (num % 10 != a && num % 10 != b) return false;
    num /= 10;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long ans = 0;
  cin >> a >> b >> n;
  pre(n);
  for (long long i = n; i >= 0; i--) {
    if (check((i * a) + (n - i) * b)) ans = (ans + ncr(n, i)) % mod;
  }
  cout << ans << endl;
  return 0;
}
