Hide

Problem A
Random Permutation

An integer sequence with length n, denoted by a1,a2,,an, is generated randomly, and the probability of being 1,2,,n are all 1n for each ai (i=1,2,,n).

Your task is to calculate the expected number of permutations p1,p2,,pn from 1 to n such that piai holds for each i=1,2,,n.

Input

The only line contains an integer n (1n50).

Output

Output the expected number of permutations satisfying the condition. Your answer is acceptable if its absolute or relative error does not exceed 109.

Formally speaking, suppose that your output is x and the jury’s answer is y. Your output is accepted if and only if |xy|max(1,|y|)109.

Sample Input 1 Sample Output 1
2
1.000000000000
Sample Input 2 Sample Output 2
3
1.333333333333
Sample Input 3 Sample Output 3
50
104147662762941310907813025277584020848013430.758061352192
Hide

Please log in to submit a solution to this problem

Log in