#include <bits/stdc++.h>
using namespace std;
using LL = unsigned long long;
const int M = 1e6 + 3;
const int mo = 1e9 + 7;
const LL inf = 1e18 + 1;
LL qpow(LL a, LL b) {
  LL res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
LL c[M];
void init(LL n) {
  c[0] = 1;
  for (int i = 1; i <= n; i++)
    c[i] = (c[i - 1] * (n - i + 1) % mo) * qpow(i, mo - 2) % mo;
}
bool check(LL ans, LL a, LL b) {
  while (ans > 0) {
    int c = ans % 10;
    if (c != a && c != b) return false;
    ans /= 10;
  }
  return true;
}
int main() {
  LL a, b, n;
  cin >> a >> b >> n;
  init(n);
  LL res = 0;
  for (int k1 = 0; k1 <= n; k1++) {
    int k2 = n - k1;
    LL ans = a * k1 + b * k2;
    if (check(ans, a, b)) res = (res + c[k1]) % mo;
  }
  cout << res << endl;
  return 0;
}
