#include <bits/stdc++.h>
using namespace std;
template <typename T, size_t N>
struct array {
  T val[N];
  T& operator[](size_t n) {
    if (n >= N) assert(false);
    return val[n];
  }
  T* begin() { return &val[0]; }
  T* end() { return &val[0] + N; }
};
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
const int inf = 0x3f3f3f3f;
const long long inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
class verh {
 public:
  bool use, u2;
  int n;
  int col;
  vector<verh*> child;
  bool p;
};
int dfs(verh& v) {
  int ans = 1;
  v.use = true;
  for (int i = 0; i < v.child.size(); ++i) {
    if (v.child[i]->use == false) ans += dfs(*v.child[i]);
  }
  v.col = ans;
  return ans;
}
void print(verh& v) {
  v.u2 = true;
  cout << v.n << " ";
  for (int i = 0; i < v.child.size(); ++i) {
    for (int i = 0; i < v.child.size(); ++i) {
      if (v.child[i]->u2 == false) print(*v.child[i]);
    }
  }
}
unsigned long long s[10000001];
int main() {
  ios_base::sync_with_stdio(false);
  int a, b, n;
  cin >> a >> b >> n;
  unsigned long long last = 1;
  vector<unsigned long long> r(n + 1);
  r[1] = 1;
  for (int i = 2; i <= n; ++i)
    r[i] = (1000000007 - (1000000007 / i) * r[1000000007 % i] % 1000000007) %
           1000000007;
  r[0] = 1;
  s[0] = 1;
  vector<unsigned long long> fac(n + 1);
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fac[i] = r[i] * fac[i - 1];
    fac[i] %= 1000000007;
  }
  for (int i = 1; i <= n; ++i) {
    last *= i;
    last %= 1000000007;
  }
  for (int i = 1; i <= n; ++i) {
    s[i] = fac[i] * fac[n - i];
    s[i] %= 1000000007;
    s[i] *= last;
    s[i] %= 1000000007;
  }
  unsigned long long ans = 0;
  for (int i = 0; i <= n; ++i) {
    int sum = i * a + (n - i) * b;
    int c = sum;
    while (sum != 0 && (sum % 10 == a || sum % 10 == b)) {
      sum /= 10;
    }
    if (sum == 0) {
      ans += s[i];
      ans %= 1000000007;
    }
  }
  cout << ans;
  return 0;
}
