Hide

Problem A
Tight words

Given is an alphabet $\{ 0, 1, \dots , k\} , 0 \leq k\leq 9$. We say that a word of length $n$ over this alphabet is tight if any two neighbour digits in the word do not differ by more than 1.

For example if $k=2$, we may only use digits $0, 1, 2$. These are the tight words of length $2$: 00, 01, 10, 11, 12, 21, 22. There are $9$ words of length $2$, so the percentage of tight words is $7/9=77.777\% $.

Input

Input is a sequence of lines, each line contains two integer numbers $k$ and $n$, $1\leq n \leq 100$.

Output

For each line of input, output the percentage of tight words of length $n$ over the alphabet $\{ 0, 1, \dots , k\} $.

The output is considered correct if it is within relative or absolute error $10^{-7}$.

Sample Input 1 Sample Output 1
4 1
2 5
3 5
8 7
100.000000000
40.740740741
17.382812500
0.101296914

Please log in to submit a solution to this problem

Log in