#P222. 【例37.2】 求分数序列和

【例37.2】 求分数序列和

Description

There is a sequence of fractions q1p1\frac{q_1}{p_1}, q2p2\frac{q_2}{p_2}, q3p3\frac{q_3}{p_3}, q4p4\frac{q_4}{p_4}, q5p5\frac{q_5}{p_5}, ..., where qi+1=qi+piq_{i+1}=q_i+p_i, pi+1=qip_{i+1}=q_i, p1=1p_1=1, and q1=2q_1=2. For example, the first 5 terms of this sequence are 21\frac{2}{1}, 32\frac{3}{2}, 53\frac{5}{3}, 85\frac{8}{5}, 138\frac{13}{8}. Calculate the sum of the first n terms of this sequence.

Input Format

Input consists of a single line containing a positive integer n (n≤30).

Output Format

Output consists of a single line containing a floating-point number representing the sum of the first n terms of the sequence, rounded to 4 decimal places.

Sample

2
3.5000