#C9511. Polynomial Evaluation

    ID: 53613 Type: Default 1000ms 256MiB

Polynomial Evaluation

Polynomial Evaluation

Given a polynomial (P(x)=a_0+a_1x+a_2x^2+\cdots+a_{n-1}x^{n-1}), your task is to evaluate (P(x)) at a given value (x) and output the result rounded to the nearest integer.

You will be provided with an integer (n) representing the number of coefficients, followed by (n) coefficients in order (from the constant term to the highest degree term), and finally a floating-point number (x).

The expression for the polynomial is given by:
[ P(x)=\sum_{i=0}^{n-1}a_i x^i ]
Compute (P(x)) and print the rounded result.

inputFormat

The input is provided via standard input (stdin) and consists of three parts:
1. The first line contains an integer (n), which is the number of coefficients.
2. The second line contains (n) space-separated numbers representing the coefficients (a_0, a_1, \dots, a_{n-1}).
3. The third line contains a floating-point number (x), at which the polynomial should be evaluated.

outputFormat

Output a single integer to standard output (stdout): the value of the polynomial (P(x)) computed and rounded to the nearest integer.## sample

1
5
10
5