#include <bits/stdc++.h>
using namespace std;
int check(int t, int x, int y) {
  while (t) {
    int k = t % 10;
    if (k != x && k != y) return 0;
    t /= 10;
  }
  return 1;
}
long long c[1000010];
long long power(long long t, int n) {
  long long ans = 1;
  while (n) {
    if (n % 2) {
      ans *= t;
      ans %= 1000000007;
    }
    t *= t;
    t %= 1000000007;
    n /= 2;
  }
  return ans;
}
int C(int n, int m) {
  long long t = c[m] * c[n - m];
  t %= 1000000007;
  long long ans = c[n] * power(t, 1000000007 - 2);
  return ans % 1000000007;
}
int main() {
  int x, y, n;
  cin >> x >> y >> n;
  int ans = 0;
  c[0] = 1;
  for (int i = 1; i <= n; i++) {
    c[i] = c[i - 1] * i;
    c[i] %= 1000000007;
  }
  for (int i = 0; i <= n; i++) {
    int t = i * x + y * (n - i);
    if (check(t, x, y) == 0) continue;
    ans += C(n, i);
    ans %= 1000000007;
  }
  cout << ans << endl;
}
