#include <bits/stdc++.h>
using namespace std;
long long pow2(long long base, long long p) {
  long long ans = 1;
  while (p > 0) {
    if (p & 1)
      ans = (((ans) % 1000000007) * ((base) % 1000000007)) % 1000000007;
    base = (((base) % 1000000007) * ((base) % 1000000007)) % 1000000007;
    p = p / 2;
  }
  return ans;
}
int main() {
  long long arr[1000006];
  arr[0] = 1;
  for (int i = 1; i < 1000006; i++) arr[i] = (arr[i - 1] * i) % 1000000007;
  long long a, b, n;
  long long ans = 0;
  cin >> a >> b >> n;
  for (int i = 0; i < n + 1; i++) {
    long long sum = a * i + b * (n - i);
    long long temp = sum;
    long long flag = 1;
    while (temp > 0) {
      long long dig = temp % 10;
      if (dig != a && dig != b) {
        flag = 0;
        break;
      }
      temp = temp / 10;
    }
    if (flag == 1) {
      ans = (ans + ((arr[n] % 1000000007) *
                    (pow2(((arr[i] % 1000000007) * (arr[n - i] % 1000000007)) %
                              1000000007,
                          1000000007 - 2)) %
                    1000000007) %
                       1000000007) %
            1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
