#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
int a, b, n;
long long inv[maxn], Cn[maxn], ans;
bool check(int x) {
  while (x) {
    int tmp = x % 10;
    if (tmp != a && tmp != b) return false;
    x /= 10;
  }
  return true;
}
void init() {
  inv[1] = 1;
  for (int i = 2; i < maxn; i++) inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
  Cn[0] = 1;
  for (int i = 1; i < n + 1; i++)
    Cn[i] = (n - i + 1) * inv[i] % MOD * Cn[i - 1] % MOD;
}
int main() {
  scanf("%d%d%d", &a, &b, &n);
  init();
  for (int i = 0; i < n + 1; i++) {
    if (check(i * a + (n - i) * b)) ans = (ans + Cn[i]) % MOD;
  }
  cout << ans << endl;
}
