Problem B. Ball of fir ≡

• problems
 Author: G. Grenkin Time limit: 1 sec Input file: input.txt Memory limit: 256 Mb Output file: output.txt

Statement

Mathematicians from the Institute of New Year Research developed a mathematical model of the New Year fir-tree. In this model the fir is supposed to be a sphere with a radius of 1 meter. Modeling of a fir garland is, however, more complicated.

A fir garland is modeled with a curve located on the sphere. The curve begins at the topmost point of the sphere, ends at the bottommost point of the sphere, and makes exactly N turns around it.

Consider spherical coordinates φ (longitude) and θ (latitude). The initial value of longitude equals 0, longitude makes exactly N turns and the final value equals 0 again. The initial value of latitude equals 90°, the final value equals  − 90°. The increment of latitude is proportional to the increment of longitude.

Your program must, for a given value of N, calculate the length of the curve which models a fir garland.

Input file format

Input file contains a single integer N.

Output file format

Output file must contain a single real number — the length of the curve (in meters) with at least 3 correct digits after decimal point.

1 ≤ N ≤ 100

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
1
5.270
2
3
12.612

Explanation

Для решения задачи необходимо найти параметрическое представление кривой сначала в сферических, а затем в декартовых координатах. Затем для приближённого вычисления длины кривой аппроксимируем кривую ломаной и вычислим длину этой ломаной.

0.191s 0.015s 17