#include <bits/stdc++.h>
using namespace std;
long long modularExponentiation(long long x, long long n, long long M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x) % M, n / 2, M);
  else
    return (x * modularExponentiation((x * x) % M, (n - 1) / 2, M)) % M;
}
long long modInverse(long long A, long long M) {
  return modularExponentiation(A, M - 2, M);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long fact[1000001], A, B, N, ans = 0;
  fact[0] = 1;
  for (long long i = 1; i <= 1000000; i++) {
    fact[i] = fact[i - 1] * i;
    fact[i] = fact[i] % 1000000007;
  }
  cin >> A >> B >> N;
  for (long long i = 0; i <= N; i++) {
    long long num = i * A + (N - i) * B, temp = fact[N], flag = 1;
    while (num != 0) {
      if (num % 10 == A || num % 10 == B)
        num = num / 10;
      else {
        flag = 0;
        break;
      }
    }
    if (flag) {
      temp = (temp * modInverse(fact[i], 1000000007) + 1000000007) % 1000000007;
      temp = (temp * modInverse(fact[N - i], 1000000007) + 1000000007) %
             1000000007;
      ans += temp;
      ans = ans % 1000000007;
    }
  }
  cout << ans << "\n";
}
