#Z14120. 求分数序列和

求分数序列和

Description

There is a sequence of fractions $\frac{q\_1}{p\_1}, \frac{q\_2}{p\_2}, \frac{q\_3}{p\_3}, \frac{q\_4}{p\_4}, \frac{q\_5}{p\_5}, \dots$, where q_i+1=q_i+p_iq\_{i+1} = q\_i + p\_i, p_i+1=q_ip\_{i+1} = q\_i, p_1=1p\_1 = 1, and q_1=2q\_1 = 2. For example, the first 6 terms of this sequence are $\frac{2}{1}, \frac{3}{2}, \frac{5}{3}, \frac{8}{5}, \frac{13}{8}, \frac{21}{13}$. Calculate the sum of the first n terms of this fraction sequence.

Input Format

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

Output Format

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

2

3.5000