Under construction

Still being built. Things may change

Ensemble Gomgom

Interview

Time limit1sMemory limit1024 MB

Summary
Given N members who each pick one of K notes with equal probability, find the expected number of pairs that play the same note.
Level

Easy3 of 10

Topics
Probability, Math
Solved
No attempts yet

Problem

Gomgom plays the xylophone very well.

When Gomgom's mallet touches the keys, everyone nearby pays attention to the clear sound of the xylophone.

Gomgom formed an ensemble to make people happy with this talent. The ensemble has many Gomgoms, and each Gomgom takes one note and plays it following the score.

Gomgom's xylophones sound clearer when several Gomgoms play the same note together. So they decided to group the Gomgoms who play the same note.

After a successful performance, each member of a group has a meal alone with every other member of the group, one at a time, to get to know each other.

The ensemble leader, Gomgom, pays for these meals, so the leader must know the amount in advance to prepare the money before the show.

The score has not been decided yet, so the number of members in each group is unknown, and the exact cost cannot be calculated.

Therefore, the leader wants to find the expected number of meals and prepare money for that amount.

Assume that the note each Gomgom plays is chosen with equal probability from the KK available notes.

Help the leader so that no member goes without a meal!

Input

The first line contains the number of ensemble members NN (2≤N≤1 0002 \le N \le 1\ 000) and the number of notes KK (1≤K≤1 0001 \le K \le 1\ 000) that Gomgom can play, in that order.

Output

Print the expected number of meals. An absolute or relative error of up to 10−610^{-6} is allowed.

Examples1

  1. Example 1

    Input
    3 2
    
    Expected output
    1.500000