There lives a boy Ketan in the village Kusht. He owns some magical clay and a witty brain. He wants to completely destroy his village by removing the only source of income, trees. There are a total of M varieties of trees with K trees for each variety, so the village has a total of M*K trees. The magical clay is capable of destroying any kind of tree except the holy Sal Tree. So, basically the magical clay can destroy (M-1) kinds of trees.
All the trees are planted in a line in a random order. Ketan plans to place the magical clay in the soil of the first tree. Since the clay is magical it can itself move to the next tree in the line after destroying a particular tree but if the clay reaches the holy Sal tree, it gets destroyed.
All you need to find is the expected number of trees that will be killed in the process. This expected value can be written as a fraction P/Q, where P and Q are coprime. Therefore, you should compute P⋅Q−1 modulo 1000000007 (109 + 7) , where Q−1 denotes the modular inverse of Q modulo 1000000007.
The only line of input contains 2 numbers M and K.
Print a single line containing one integer — the number equivalent to the expected number of trees killed modulo 1000000007.
1 ≤ M ≤ 1012
1 ≤ K ≤ 106
There are only 2 types of trees. Let us number them 1 and 2 (1 is the Holy Sal Tree). The only possible arrangements are [1, 2], [2, 1]. In the first arrangement, no tree gets killed. In the second arrangement, tree type 2 gets killed first and then holy tree will kill the magical clay. So the expected number of killed trees = (½ * 0 + ½ * 1) modulo 109 + 7 = ½ modulo 109 + 7 = 500000004