CF1205E Expected Value Again
Description
You are given integers $ n $ , $ k $ . Let's consider the alphabet consisting of $ k $ different elements.
Let beauty $ f(s) $ of the string $ s $ be the number of indexes $ i $ , $ 1\le i
Input Format
The first and the only line contains two integers $ n $ , $ k $ ( $ 1\le n \le 10^5 $ , $ 1\le k\le 10^9 $ ) — the length of a string and the size of alphabet respectively.
Output Format
Output a single integer — $ P\times Q^{-1} \bmod 10^9 + 7 $ .
Explanation/Hint
In the first example, there are $ 9 $ words of length $ 2 $ in alphabet of size $ 3 $ — $ aa $ , $ ab $ , $ ac $ , $ ba $ , $ bb $ , $ bc $ , $ ca $ , $ cb $ , $ cc $ . $ 3 $ of them have beauty $ 1 $ and $ 6 $ of them have beauty $ 0 $ , so the average value is $ \frac{1}{3} $ .
In the third example, there is only one such word, and it has beauty $ 99 $ , so the average value is $ 99^2 $ .