#include <bits/stdc++.h>
using namespace std;
template <class T>
static void print_stl_cont(const T &v, const string &desc = "") {
  if (!desc.empty()) {
    cerr << desc << ": ";
  }
  int i = 0;
  for (auto x : v) {
    cout << "[" << i++ << "]=" << x << " ";
  }
  cout << endl;
}
const long long MOD = (long long)1000000007;
const long long MAXN = (long long)1e6;
long long factorial[MAXN + 1];
long long inv[MAXN + 1];
long long gcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
void precompute() {
  factorial[0] = 1;
  for (int i = 1; i <= MAXN; i++) {
    factorial[i] = factorial[i - 1] * i % MOD;
  }
}
long long calc_inv(long long a) {
  long long x = -1, y = -1;
  long long g = gcd(a, MOD, x, y);
  if (g != 1) {
    return -1;
  } else {
    x = (x % MOD + MOD) % MOD;
  }
  return x;
}
long long binomial_coefficient(long long n, long long k) {
  return factorial[n] * calc_inv(factorial[k]) % MOD *
         calc_inv(factorial[n - k]) % MOD;
}
bool find_any_solution(long long a, long long b, long long c, long long &x0,
                       long long &y0, long long &g) {
  g = gcd(abs(a), abs(b), x0, y0);
  if (c % g) {
    return false;
  }
  x0 *= c / g;
  y0 *= c / g;
  if (a < 0) x0 = -x0;
  if (b < 0) y0 = -y0;
  return true;
}
long long is_good(long long x, long long a, long long b) {
  if (x <= 0) {
    return false;
  }
  while (x) {
    if ((x % 10) != a && (x % 10) != b) {
      return false;
    }
    x /= 10;
  }
  return true;
}
int main() {
  cin.sync_with_stdio(false);
  long long a;
  cin >> a;
  ;
  long long b;
  cin >> b;
  ;
  long long n;
  cin >> n;
  ;
  precompute();
  long long res = 0;
  for (long long num_a = 0; num_a <= n; ++num_a) {
    long long num_b = n - num_a;
    long long s = a * num_a + b * num_b;
    if (!is_good(s, a, b)) continue;
    res += binomial_coefficient(n, num_a);
    res %= MOD;
  }
  cout << res;
  return 0;
}

### Prompt

Generate a CPP solution to the following problem:

Vitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if the sum of its digits is a good number.

For example, let's say that Vitaly's favourite digits are 1 and 3, then number 12 isn't good and numbers 13 or 311 are. Also, number 111 is excellent and number 11 isn't. 

Now Vitaly is wondering, how many excellent numbers of length exactly n are there. As this number can be rather large, he asks you to count the remainder after dividing it by 1000000007 (109 + 7).

A number's length is the number of digits in its decimal representation without leading zeroes.

Input

The first line contains three integers: a, b, n (1 ≤ a < b ≤ 9, 1 ≤ n ≤ 106).

Output

Print a single integer — the answer to the problem modulo 1000000007 (109 + 7).

Examples

Input

1 3 3


Output

1


Input

2 3 10


Output

165

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
static void print_stl_cont(const T &v, const string &desc = "") {
  if (!desc.empty()) {
    cerr << desc << ": ";
  }
  int i = 0;
  for (auto x : v) {
    cout << "[" << i++ << "]=" << x << " ";
  }
  cout << endl;
}
const long long MOD = (long long)1000000007;
const long long MAXN = (long long)1e6;
long long factorial[MAXN + 1];
long long inv[MAXN + 1];
long long gcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
void precompute() {
  factorial[0] = 1;
  for (int i = 1; i <= MAXN; i++) {
    factorial[i] = factorial[i - 1] * i % MOD;
  }
}
long long calc_inv(long long a) {
  long long x = -1, y = -1;
  long long g = gcd(a, MOD, x, y);
  if (g != 1) {
    return -1;
  } else {
    x = (x % MOD + MOD) % MOD;
  }
  return x;
}
long long binomial_coefficient(long long n, long long k) {
  return factorial[n] * calc_inv(factorial[k]) % MOD *
         calc_inv(factorial[n - k]) % MOD;
}
bool find_any_solution(long long a, long long b, long long c, long long &x0,
                       long long &y0, long long &g) {
  g = gcd(abs(a), abs(b), x0, y0);
  if (c % g) {
    return false;
  }
  x0 *= c / g;
  y0 *= c / g;
  if (a < 0) x0 = -x0;
  if (b < 0) y0 = -y0;
  return true;
}
long long is_good(long long x, long long a, long long b) {
  if (x <= 0) {
    return false;
  }
  while (x) {
    if ((x % 10) != a && (x % 10) != b) {
      return false;
    }
    x /= 10;
  }
  return true;
}
int main() {
  cin.sync_with_stdio(false);
  long long a;
  cin >> a;
  ;
  long long b;
  cin >> b;
  ;
  long long n;
  cin >> n;
  ;
  precompute();
  long long res = 0;
  for (long long num_a = 0; num_a <= n; ++num_a) {
    long long num_b = n - num_a;
    long long s = a * num_a + b * num_b;
    if (!is_good(s, a, b)) continue;
    res += binomial_coefficient(n, num_a);
    res %= MOD;
  }
  cout << res;
  return 0;
}

```