#include <bits/stdc++.h>
using namespace std;
int a, b, n;
const int MOD = 1e9 + 7;
long long fac[1111111];
bool ok(int x) {
  while (x) {
    if (x % 10 == a || x % 10 == b) {
      x /= 10;
    } else
      return 0;
  }
  return 1;
}
void init() {
  fac[0] = fac[1] = 1;
  for (int i = 2; i <= 1000000; i++) {
    fac[i] = (fac[i - 1] * i) % MOD;
  }
}
void gcd(long long a, long long b, long long& d, long long& x, long long& y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    gcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long inv(long long a, long long n) {
  long long d, x, y;
  gcd(a, n, d, x, y);
  return d == 1 ? (x + n) % n : -1;
}
long long C(int n, int m) {
  return fac[n] * inv(fac[m] * fac[n - m] % MOD, MOD) % MOD;
}
int main() {
  init();
  long long ans;
  int len;
  while (scanf("%d%d%d", &a, &b, &n) != EOF) {
    ans = 0;
    for (len = 0; len <= n; len++) {
      if (ok(a * len + b * (n - len))) ans = (ans + C(n, len)) % MOD;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
