#include <bits/stdc++.h>
long long int po(long long int x, long long int n, long long int M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return po((x * x) % M, n / 2, M);
  else
    return (x * po((x * x) % M, (n - 1) / 2, M)) % M;
}
long long fact[1000005];
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, i = 1, j, pro = 1, a, b, ans = 0;
  cin >> a >> b >> n;
  fact[0] = 1;
  for (i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
  }
  for (i = 0; i <= n; i++) {
    long long good = i * a + (n - i) * b, f1 = 0;
    while (good != 0) {
      if (good % 10 != a && good % 10 != b) {
        f1 = 1;
        break;
      }
      good /= 10;
    }
    if (f1 != 1) {
      ans =
          (ans +
           (((fact[n] * po(fact[i], 1000000007 - 2, 1000000007)) % 1000000007) *
            po(fact[n - i], 1000000007 - 2, 1000000007)) %
               1000000007) %
          1000000007;
    }
  }
  cout << ans;
  return 0;
}
