wzj has invented a brand new Ludo game! This game comes with a huge board and a giant die.
wzj really enjoys this game, but he can never gather enough players to start a match. Other people think one full game takes far too much time, so no one wants to play with him.
He wants to prove that the game can end quickly if everyone plays with the optimal strategy. Unfortunately, he does not know how to calculate the exact number of turns.
Could you help him solve this problem?
The board has $$$n$$$ cells numbered from $$$1$$$ to $$$n$$$. Initially, wzj's piece is placed on cell $$$1$$$. There is an $$$m$$$-sided die. Each roll generates an integer chosen uniformly at random from $$$1$$$ to $$$m$$$.
In each turn, wzj first rolls the die. Let the result be $$$x$$$. After seeing $$$x$$$, he has two choices: move forward by $$$x$$$ steps, or skip the turn and stay in place.
The goal is to reach cell $$$n$$$ as quickly as possible.
Under the optimal strategy (which minimizes the expected number of turns to reach cell $$$n$$$), calculate the expected number of turns needed for wzj to travel from cell $$$1$$$ to cell $$$n$$$.
One line contains two positive integers $$$n, m$$$ ($$$2 \le n \le 10^5$$$, $$$1 \le m \lt n$$$), representing the total number of cells and the number of faces of the die.
Print a single real number, which is the expected number of turns under the optimal strategy. Your answer is considered correct if the absolute error or relative error between your output and the standard answer is no more than $$$10^{-6}$$$.
8 6
7.0000000000
4 2
3.0000000000
5 2
3.5000000000
100 6
33.0476190476