# 50166. Newton's Method

## I'm a slow walker, but I never walk backwards.

Implement Newton's method, which is a root-finding algorithm.
Let $f$ be a differentiable function defined on the interval (a, b).
To simplify the task we will assume that $f$ is a polynomial of $x$.
We start with $x_{1}$ and find the line at $(𝑥_{1} ,ƒ(𝑥_{1}))$ with slope $f'(x_{1})$.
This line will intersect with the $x$-axis at $(x_{2}, 0)$.
We then repeat this procedure to find $x_{3}, x_{4}$, and so on.
Please refer to the following illustration.

Your program will iterate Newton's method for k times and output $𝑥_{k}$ and $ƒ(𝑥_{k})$ in each iteration.

## Input Format

There are four lines in the input.
The first line is the degree $d$ of polynomial.

• $1 \lt d \lt 10$

The second line contains the coefficients of the polynomial and each of them should be double.
For example: $1.54𝑥^3 +3.88𝑥 -4.742$ is denoted as 1.54 0.0 3.88 -4.742.

The third line is the maximum iteration $k$.

• $0 \lt k \lt 1000$

The last line is $𝑥_{1}$. It should be double.

## Output Format

You need to output $x_{i}$ and $f(x_{i})$ for every iteration. Please "%.4f" in printf function to output the answers.

## Sample Input 1

31.54 0.0 3.88 -4.7421330.999


## Sample Output 1

30.9990 45989.234420.6490 13634.110713.7414 4044.42739.1258 1201.04526.0353 357.22013.9604 106.28582.5682 31.30841.6568 8.68991.1321 1.88490.9398 0.18250.9168 0.00230.9166 0.00000.9166 0.0000