#include using namespace std; long nCrModpDP(long n, long r, long p) { // The array C is going to store last row of // pascal triangle at the end. And last entry // of last row is nCr long C[r+1]; memset(C, 0, sizeof(C)); C[0] = 1; // Top row of Pascal Triangle // One by constructs remaining rows of Pascal // Triangle from top to bottom for (long i = 1; i <= n; i++) { // Fill entries of current row using previous // row values for (long j = min(i, r); j > 0; j--) // nCj = (n-1)Cj + (n-1)C(j-1); C[j] = (C[j] + C[j-1])%p; } return C[r]; } // Lucas Theorem based function that returns nCr % p // This function works like decimal to binary conversion // recursive function. First we compute last digits of // n and r in base p, then recur for remaining digits long nCrModpLucas(long n, long r, long p) { // Base case if (r==0) return 1; // Compute last digits of n and r in base p long ni = n%p, ri = r%p; // Compute result for last digits computed above, and // for remaining digits. Multiply the two results and // compute the result of multiplication in modulo p. return (nCrModpLucas(n/p, r/p, p) * // Last digits of n and r nCrModpDP(ni, ri, p)) % p; // Remaining digits } long countArray(int n, int k, int x) { // Return the number of ways to fill in the array. return nCrModpLucas(x+1, n-2, 100000007); } int main() { int n; int k; int x; cin >> n >> k >> x; long answer = countArray(n, k, x); cout << answer << endl; return 0; }