#include <bits/stdc++.h>
using namespace std;
long long a, b;
vector<long long> dp(1000001);
bool is_good(long long x) {
  long long k = x;
  while (k > 0) {
    long long c = k % 10;
    if (c != a && c != b) return false;
    k /= 10;
  }
  return true;
}
long long fat(long long x) { return dp[x]; }
long long mp(long long x, long long y) {
  long long result = 1;
  while (y > 0) {
    if (y & 1) result *= x;
    y /= 2;
    x = (x * x) % (1000000007);
    result %= (1000000007);
  }
  return result;
}
int main() {
  std::ios::sync_with_stdio(false);
  long long n;
  cin >> a >> b >> n;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = i * dp[i - 1];
    dp[i] %= (1000000007);
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    long long initial = a * i + b * (n - i);
    if (is_good(initial)) {
      ans +=
          fat(n) * mp((fat(n - i) * fat(i)) % (1000000007), (1000000007) - 2);
      ans %= (1000000007);
    }
  }
  cout << ans << "\n";
}
