atcoder#ABC194D. [ABC194D] Journey

[ABC194D] Journey

Score : 400400 points

Problem Statement

We have a graph with NN vertices called Vertex 11 through NN. Takahashi is standing on Vertex 11. The graph has no edges now. Takahashi will repeatedly do the following operation:

  1. Choose one of the NN vertices (including the one on which Takahashi is standing now). Every vertex is chosen with probability 1N\frac{1}{N}, independently from previous operations.
  2. Add an edge between the vertex on which Takahashi is standing now and the chosen vertex, and go to the chosen vertex.

Find the expected value of the number of times he does the operation until the graph becomes connected.

Constraints

  • 2N1052 \le N \le 10^5

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer. Your answer will be considered correct when its absolute or relative error from our answer is at most 10610^{-6}.

2
2.00000000000

The graph becomes connected when the operation chooses Vertex 22 for the first time. By considering the case Vertex 22 is chosen for the first time in the ii-th operation for each ii, the answer is $\sum_{i = 1}^{\infty} (i \times (\frac{1}{2})^i) = 2$.

3
4.50000000000