#include <bits/stdc++.h>
int a, b;
int n;
long long int fact[1000006];
long long int c[1000006];
int digits(int i) {
  int flag = 0;
  while (i != 0) {
    int rem = i % 10;
    if (rem != a && rem != b) {
      flag = 1;
      break;
    }
    i = i / 10;
  }
  return (flag + 1) % 2;
}
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int temp = power(a, b / 2);
  temp = ((temp % 1000000007) * (temp % 1000000007)) % 1000000007;
  if (b & 1) temp = (temp * a) % 1000000007;
  return temp;
}
int main() {
  scanf("%d%d%d", &a, &b, &n);
  int maxsum = b * n;
  int minsum = a * n;
  long long int ways = 0;
  int d = b - a;
  fact[0] = 1;
  fact[1] = 1;
  for (int i = 2; i <= n; i++)
    fact[i] = ((fact[i - 1] % 1000000007) * (i % 1000000007)) % 1000000007;
  for (int i = 0; i <= n; i++)
    c[i] = ((fact[n] % 1000000007) *
            (power((fact[n - i] * fact[i]) % 1000000007, 1000000007 - 2))) %
           1000000007;
  for (int i = minsum; i <= maxsum; i++) {
    if (digits(i)) {
      int diff = i - minsum;
      if (diff % d == 0) {
        int times = diff / d;
        if (times == 0) {
          ways = (ways + 1) % 1000000007;
          continue;
        }
        long long int combi = 1;
        int x = times;
        combi = c[x];
        ways = (ways % 1000000007 + combi % 1000000007) % 1000000007;
      }
    }
  }
  printf("%lld\n", ways);
  return 0;
}
