#include <bits/stdc++.h>
using namespace std;
int m = pow(10, 9) + 7;
unsigned long long Fac[1000001];
bool isBeautiful(int a, int b, int z) {
  string str = to_string(z);
  for (int i = 0; i < str.length(); i++) {
    if (!(str[i] - '0' == a || str[i] - '0' == b)) {
      return false;
    }
  }
  return true;
}
unsigned long long power(unsigned long long x, unsigned long long n) {
  unsigned long long res = 1;
  while (n > 0) {
    if (n % 2 != 0) {
      res = ((res % m) * (x % m)) % m;
    }
    x = ((x % m) * (x % m)) % m;
    n /= 2;
  }
  return res;
}
unsigned long long inv(unsigned long long a, unsigned long long m) {
  return power(a, m - 2);
}
void fillFac(int n) {
  Fac[0] = Fac[1] = 1;
  for (int i = 2; i <= n; i++) {
    Fac[i] = i * (Fac[i - 1] % m);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.tie(NULL);
  int a, b, n, y, z;
  int ans = 0;
  cin >> a >> b >> n;
  fillFac(n);
  for (int x = 0; x <= n; x++) {
    z = a * x + b * (n - x);
    if (isBeautiful(a, b, z) == true) {
      ans = (ans % m +
             (((Fac[n] % m) * (((inv(Fac[x], m)) * (inv(Fac[n - x], m))) % m)) %
              m)) %
            m;
    }
  }
  cout << ans << endl;
}
