#include <bits/stdc++.h>
using namespace std;
int INP, AM, REACHEOF;
char BUF[(1 << 12) + 1], *inp = BUF;
const long double PI = acos((long double)-1.0);
const long long MOD = 1000000007LL;
long long power(int x, int k) {
  if (k == 0) return 1;
  if (k == 1) return x;
  long long mid = power(x, k >> 1);
  mid = (mid * mid) % MOD;
  if (k & 1)
    return (mid * x) % MOD;
  else
    return mid;
}
long long f[1000111];
int n, a, b;
bool check(int n) {
  while (n) {
    int t = n % 10;
    if (t != a && t != b) return false;
    n /= 10;
  }
  return true;
}
int main() {
  f[0] = 1;
  while (cin >> a >> b >> n) {
    for (int k = (1), _b = (n); k <= _b; k++)
      f[k] = f[k - 1] * (n - k + 1) % MOD * power(k, MOD - 2) % MOD;
    int res = 0;
    for (int x = (0), _b = (n); x <= _b; x++) {
      if (check(a * x + b * (n - x))) res = (res + f[x]) % MOD;
    }
    cout << res << endl;
  }
  return 0;
}
