405846: GYM102134 G Many dimensional dice

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Many dimensional dicetime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

All Andrews in general like to play different games. This Andrew is not an exception and he likes to do it as well. Recently, he has attended a casino under some unknown circumstances. Croupier has offered him to play some very attractive game.

You are given a dice with k faces. Each of them has a unique number from 1 to k. You are allowed to roll a dice no more n times and stop after some arbitrary chosen round. The amount of money you win is equals to the last number appeared on the dice top face. All of the outcomes after rolling a dice have equal probabilities of appearance.

Andrew is a quite strong mathematician and hence knows the optimal strategy to maximize the award. Your task is to compute the expected value of the award if you are playing like Andrew, i.e. following the optimal strategy.

Input

A single line contains two integers n and k.

1 ≤ n, 1 ≤ k, n × k ≤ 1012

Output

A single line should contain a single real number – expected amount of money you may win following the optimal strategy. Absolute and relative error should not exceed 10 - 9.

ExamplesInput
1 6
Output
3.500000000000000
Input
2 6
Output
4.250000000000000

加入题单

上一题 下一题 算法标签: