#include <bits/stdc++.h>
using namespace std;
int mod_pow(long long a, int b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return ret;
}
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  long long C = 1;
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    int sum = i * a + (n - i) * b;
    bool ok = true;
    while (sum) {
      int d = sum % 10;
      sum /= 10;
      if (d != a && d != b) ok = false;
    }
    if (ok) ans = (ans + C) % 1000000007;
    C = C * (n - i) % 1000000007;
    C = C * mod_pow(i + 1, 1000000007 - 2) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
