#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int M = 1e9 + 7;
int fac[N];
bool che(int s, int a, int b) {
  while (s > 0) {
    if (!(s % 10 == a || s % 10 == b)) {
      return false;
    }
    s /= 10;
  }
  return true;
}
int bin(int a, int n) {
  int res = 1;
  while (n > 0) {
    if (n & 1) {
      res = 1ll * res * a % M;
    }
    a = 1ll * a * a % M;
    n /= 2;
  }
  return res;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, b, n;
  cin >> a >> b >> n;
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fac[i] = 1ll * fac[i - 1] * i % M;
  }
  int res = 0;
  for (int i = 0; i <= n; ++i) {
    if (che(a * i + (n - i) * b, a, b)) {
      res += 1ll * fac[n] * bin(1ll * fac[i] * fac[n - i] % M, M - 2) % M;
      res %= M;
    }
  }
  cout << res;
}
