#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long binpow(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int a, b, n;
long long facts[1000001];
void pre() {
  facts[0] = 1;
  for (int x = 1; x <= 1000000; x++) {
    facts[x] = facts[x - 1] * x;
    facts[x] %= mod;
  }
}
long long fama(int nic) {
  long long now = facts[nic] * facts[n - nic];
  return facts[n] * binpow(now, mod - 2);
}
bool check(int x) {
  while (x != 0) {
    if (x % 10 != a && x % 10 != b) return false;
    x /= 10;
  }
  return true;
}
int ch(int x) { return b * x + a * (n - x); }
int bs(int x) {
  int lo = 0;
  int hi = n;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (ch(mid) > x) {
      hi = mid - 1;
    } else if (ch(mid) < x) {
      lo = mid + 1;
    } else {
      return mid;
    }
  }
  return -1;
}
int main() {
  pre();
  cin >> a >> b >> n;
  if (a > b) swap(a, b);
  long long ans = 0;
  for (int x = 2; x <= 9000000; x++) {
    if (check(x)) {
      int cur = bs(x);
      if (cur != -1) {
        ans += fama(cur);
        ans %= mod;
      }
    }
  }
  cout << ans;
}
