Stamp Painting

Count the distinct colorings of an N-unit canvas obtainable by stamping K-wide colored stamps so every unit ends up painted, modulo 1e9+7.

Hard9Dynamic programmingCombinatoricsMathNo attempts yetTime limit2sMemory limit512 MB

Problem

Bessie has an NN unit long strip of canvas (1N1061 \leq N \leq 10^6), and she intends to paint it. She was unable to acquire any paint brushes. In their place she has MM rubber stamps of different colors (1M1061 \leq M \leq 10^6), each stamp KK units wide (1K1061 \leq K \leq 10^6). She wants to know exactly how many different paintings she could create by stamping her stamps on the canvas in some order.

To use a stamp, align it with exactly KK neighboring units of the canvas. The stamp cannot extend beyond the ends of the canvas, and it cannot cover a fraction of a unit. Once placed, the stamp paints the KK covered units with its color. Any given stamp may be used many times, once, or never at all. By the time Bessie is finished, every unit of the canvas must have been painted at least once.

Count the paintings Bessie could produce, modulo 109+710^9 + 7. Two paintings that look identical but were made by different sequences of stamping operations count as the same painting.

Input

The first and only line has three integers NN, MM, and KK, separated by spaces. It is guaranteed that KNK \leq N.

Output

Print the number of possible paintings, modulo 109+710^9 + 7, on one line.

Hint

With N=3N = 3, M=2M = 2, K=2K = 2 and stamp colors A and B, the possible paintings are AAA, AAB, ABB, BAA, BBA, BBB, which is 6 of them.