#00066D

P-Meteorolog

Drago is a meteorologist in charge of preparing the weather forecasts. Having some values of temperature during the day, he managed to create a polynomial function to approximate the temperature at some points of the next day. But, as he is highly irresponsible, he somehow lost the function before he could calculate the final value! Given the values of temperature which he already calculated and the times which he calculated them for, please help him calculate the remaining value.


InputFrom the first line of the standard input read the integer N (2 <= N <= 10), which represents the amount of times that Drago calculated the temperature for. From the next line read N real numbers which represent the timestamps of the moments he calculated the temperature for, and from the following line read N real numbers which represent the temperatures for each of those times. Timestamps and temperatures can be negative.
From the final line of the input read the real number X, the final time that the temperature needs to be calculated for. It is guaranteed that min(timestamps) <= X <= max(timestamps).
Note: To avoid precision errors, it is recommended to store all timestamps and temperatures in the data type double for C++ / real for Pascal.

OutputWrite to the standard output the real number T, which represents the approximated temperature for the moment X, rounded to 8 decimals. Solutions deviating from the testcase by 0.0000001 will be considered correct.

Input:
2
2.0 4.0
10.0 12.0
3.0

Output:
11.00000000
Explanation: From the given data, we can conclude that the polynomial used to approximate the temperature was most likely to be P(x) = x + 8.

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.