#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;
const int maxn = (int)1e6 + 10;
int c[maxn];
int binpow(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * (long long)a % mod;
    }
    a = a * (long long)a % mod;
    b >>= 1;
  }
  return res;
}
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  c[0] = 1;
  for (int i = 1; i <= n; i++) {
    c[i] = c[i - 1] * (long long)(n - i + 1) % mod *
           (long long)binpow(i, mod - 2) % mod;
  }
  vector<int> good;
  for (int i = 1; i <= b * n; i++) {
    int x = i;
    bool ok = true;
    while (x > 0) {
      if (x % 10 != a && x % 10 != b) {
        ok = false;
        break;
      }
      x /= 10;
    }
    if (ok) {
      good.push_back(i);
    }
  }
  long long res = 0;
  for (int i = 0; i <= n; i++) {
    int j = n - i;
    if (binary_search((good).begin(), (good).end(), i * a + j * b)) {
      res += c[i];
      res %= mod;
    }
  }
  cout << res << endl;
  return 0;
}
