#P12037. Integral of a Polynomial Divided by (1+x²)

    ID: 14142 Type: Default 1000ms 256MiB

Integral of a Polynomial Divided by (1+x²)

Integral of a Polynomial Divided by (1+x²)

Cluuskarl encountered Mathematical Analysis at the University of Science and Technology and is in desperate need of help to pass her exam! Your task is to compute the definite integral

\(\displaystyle I=\int_{0}^{1}\frac{P(x)}{1+x^2}\,dx\)

where \(P(x)\) is a given polynomial of the form
\(P(x)=a_0+a_1x+a_2x^2+\cdots+a_nx^n\).

Solve this problem accurately to help her avoid failing the course.

inputFormat

The first line contains an integer \(n\) (\(n\ge0\)) representing the degree of the polynomial \(P(x)\).
The second line contains \(n+1\) space-separated numbers \(a_0, a_1, \ldots, a_n\) representing the coefficients of the polynomial.

outputFormat

Output the value of the integral \(\displaystyle\int_{0}^{1}\frac{P(x)}{1+x^2}\,dx\) as a floating-point number with at least 10 digits after the decimal point.

sample

0
1
0.7853981634