This page is still under construction.

Parts of this page are still being built. What you see may change.

Faint

Time limit1sMemory limit512 MB

Summary
Sum the absolute differences between consecutive rows of a fixed column in the lexicographically ordered list of k-subsets of {1,...,n}, modulo 1e9+7.
Level

Hard8 of 10

Topics
Combinatorics, Math, Prefix sum, Implementation
Solved
No attempts yet

Problem

Consider the set of integers {1,2,…,n}\{1, 2, \ldots, n\} and all its subsets of size kk. Write each such subset as a1,a2,…,aka_1, a_2, \ldots, a_k where a1<a2<…<aka_1 < a_2 < \ldots < a_k. Write them down in lexicographical order, one per row, obtaining a table with (nk){n \choose k} rows and kk columns. Let the jj-th integer in the ii-th row be Ai,jA_{i, j}.

Your task is to calculate the sum of absolute differences between consecutive numbers in a given column. Formally, given a positive integer mm (1≤m≤k1 \le m \le k), calculate the sum ∑i=1(nk)−1∣Ai,m−Ai+1,m∣.\sum\limits_{i = 1}^{{n \choose k} - 1} |A_{i, m} - A_{i + 1, m}|\text{.} As the answer can be very large, print it modulo 109+710^9 + 7.

Input

The only line of input contains three positive integers nn, kk and mm (1≤n≤106,1≤m≤k≤n1 \le n \le 10^6, 1 \le m \le k \le n).

Output

Print a single line with a single integer: the answer to the problem modulo 109+710^9 + 7.

Hint

In the first example, the table looks as follows.

121314232434\begin{array}{cc} 1 & 2 \\ 1 & 3 \\ 1 & 4 \\ 2 & 3 \\ 2 & 4 \\ 3 & 4 \\ \end{array}

The answer is ∣2−3∣+∣3−4∣+∣4−3∣+∣3−4∣+∣4−4∣=4|2 - 3| + |3 - 4| + |4 - 3| + |3 - 4| + |4 - 4| = 4.

Examples2

  1. Example 1

    Input
    4 2 2
    
    Expected output
    4
    
  2. Example 2

    Input
    5 3 2
    
    Expected output
    4