#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
const long long mod = 1e9 + 7;
long long s[MAXN + 5];
int check(long long ans, long long a, long long b) {
  int ok = 1;
  while (ans != 0) {
    long long x = ans % 10;
    if (x != a && x != b) ok = 0;
    ans /= 10;
  }
  return ok;
}
void exgcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0)
    x = 1, y = 0;
  else {
    exgcd(b, a % b, y, x);
    y -= x * (a / b);
  }
}
void c(long long cnt, long long n) {
  long long sum = 0, head = 1;
  long long ans = 1;
  if (s[head] == 0 && head <= cnt) head++, sum += ans;
  for (long long i = 1; i <= n; i++) {
    ans = ans * (n - i + 1) % mod;
    long long x, y;
    exgcd(i, mod, x, y);
    long long t = (x % mod + mod) % mod;
    ans = ans * t % mod;
    if (s[head] == i && head <= cnt) sum = (sum + ans) % mod, head++;
  }
  printf("%I64d\n", sum);
}
void solve(long long a, long long b, long long n) {
  long long Min = a * n, sum = 0, cnt = 0;
  while (sum <= n) {
    if (check(Min, a, b) == 1) s[++cnt] = sum;
    Min -= a, Min += b, sum++;
  }
  c(cnt, n);
}
int main() {
  long long a, b, n;
  scanf("%I64d %I64d %I64d", &a, &b, &n);
  solve(a, b, n);
}
