Under construction

Still being built. Things may change

Casino

Time limit8sMemory limit512 MB

Summary
Roll N dice up to M times, stopping whenever you like, and find the expected score under the optimal stopping strategy.
Level

Hard8 of 10

Topics
Dynamic programming, Probability, Math, Binary search
Solved
No attempts yet

Problem

The company you work for is developing a new casino game. Today you have decided to examine a game that was recently proposed.

In this game, you roll NN dice at the same time, and the sum of the rolled faces is your score. The player aims to make the score as large as possible. If you do not like the faces you rolled, you can reroll the dice, but in that case you must reroll all NN dice at the same time. You may roll the dice at most MM times. If you think the faces you rolled are large enough, you may end the game in fewer than MM rolls, and the sum of the faces from the last roll becomes your score.

To set an appropriate wager, you must find the expected value of the score. Given NN and MM, your task today is to find the expected score when using an optimal strategy.

The dice used in this game have faces numbered 1 through 6, and each face is equally likely to appear.

Input

The input consists of at most 100 datasets. Each dataset is given in the following format.

N M

The integers NN and MM satisfy 1≤N≤201 \le N \le 20 and 1≤M≤10101 \le M \le 10^{10}.

The end of the input is indicated by a line containing two zeros.

Output

For each dataset, print the expected value under an optimal strategy on a single line. The output must not have an absolute error greater than 10−210^{-2}. Solutions for this problem are expected to accumulate large numerical errors, so using a high-precision type is recommended.

Examples1

  1. Example 1

    Input
    1 2
    2 1
    2 2
    0 0
    
    Expected output
    4.25
    7
    7.9722222222