#include <bits/stdc++.h>
using namespace std;
long long pot(long long a, long long b) {
  long long r = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      r = (r * a) % 1000000007;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return r;
}
bool es(long long n, int a, int b) {
  while (n > 0) {
    if (n % 10 == a || n % 10 == b) {
      n /= 10;
    } else {
      return false;
    }
  }
  return true;
}
const int N = 1e6 + 100;
long long arr[N];
void fact() {
  arr[0] = 1;
  for (int i = 1; i < N; i++) {
    arr[i] = (arr[i - 1] * i) % 1000000007;
  }
}
long long comb(long long n, long long i) {
  long long a = arr[n];
  long long b = (arr[n - i] * arr[i]) % 1000000007;
  b = pot(b, 1000000007 - 2);
  return (a * b) % 1000000007;
}
int main() {
  fact();
  int a, b;
  long long n;
  cin >> a >> b >> n;
  long long res = 0;
  for (int x = 0; x <= n; x++) {
    if (es(a * x + b * (n - x), a, b)) {
      res = (res + comb(n, x)) % 1000000007;
    }
  }
  cout << res;
  return 0;
}
