#include <bits/stdc++.h>
using namespace std;
long long n, a, b;
bool checkInt(long long m) {
  while (m > 0) {
    if (m % 10 != a && m % 10 != b) return false;
    m /= 10;
  }
  return true;
}
int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a = a % b;
  return a;
}
void eea(long long a, long long b, long long& x, long long& y, long long& d) {
  if (!b) {
    x = 1;
    y = 0;
    d = a;
    return;
  }
  eea(b, a % b, x, y, d);
  long long x1 = y, y1 = x - (a / b) * y;
  x = x1, y = y1;
}
long long divide(long long a, long long b) {
  long long d, x, y;
  eea(b, 1000000007, x, y, d);
  return ((x + 1000000007) * (a / d)) % (1000000007 / d);
}
int main() {
  while (cin >> a >> b >> n) {
    vector<long long> c(n + 1);
    c[0] = c[n] = 1;
    for (int i = 1; i < n; i++)
      c[i] = divide((c[i - 1] * (n - i + 1)) % 1000000007, i);
    long long ans = 0;
    for (int i = 0; i <= n; i++) {
      long long sum = i * a + (n - i) * b;
      if (checkInt(sum)) ans = (ans + c[i]) % 1000000007;
    }
    cout << ans << endl;
  }
  return 0;
}
