#include <bits/stdc++.h>
using namespace std;
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long c = egcd(b, a % b, x, y);
  long long d = x;
  x = y;
  y = d - a / b * x;
  return c;
}
int n, m;
long long mod = 1000000007;
int main() {
  long long a, b, sum, now, s1, s2;
  int i, j, res;
  long long x, y;
  while (cin >> a >> b >> n) {
    sum = 0;
    s1 = 1;
    for (i = 0; i <= n;) {
      now = a * i + b * (n - i);
      while (now) {
        if (now % 10 == a || now % 10 == b)
          now /= 10;
        else
          break;
      }
      if (now == 0) {
        sum = (sum + s1) % mod;
      }
      i++;
      egcd(i, mod, x, y);
      s1 = s1 * (n - i + 1) % mod * x % mod;
    }
    res = (sum + mod) % mod;
    cout << res << endl;
  }
  return 0;
}
