#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000 * 1000 * 1000 + 7;
int a, b, n;
long long f[1000005], c[1000005];
long long fexp(long long a, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) {
      res = (res * a) % MOD;
      p--;
    }
    a = (a * a) % MOD;
    p /= 2;
  }
  return res;
}
bool check(long long x) {
  while (x) {
    if (x % 10 != a && x % 10 != b) return false;
    x /= 10;
  }
  return true;
}
int main() {
  long long x, ans = 0;
  scanf("%d %d %d", &a, &b, &n);
  f[0] = 1;
  for (int i = 1; i <= n; ++i) {
    f[i] = (f[i - 1] * i) % MOD;
  }
  for (int i = 0; i <= n; ++i) {
    c[i] = (f[n] * fexp((f[n - i] * f[i]) % MOD, MOD - 2)) % MOD;
  }
  for (int i = 0; i <= n; ++i) {
    x = a * i + b * (n - i);
    if (check(x)) {
      ans = (ans + c[i]) % MOD;
    }
  }
  cout << ans;
  return 0;
}
