#P1487. 失落的成绩单

失落的成绩单

Description

On this day, the teacher wants to check the mm-th student's grade. To avoid getting scolded, MC tries hard to recall and remembers a pattern on the report card:

If the grades are viewed as a real-valued sequence, then Ai=(Ai1)(Ai+1)2+dA_i=\dfrac{(A_{i-1})-(A_{i+1})}{2}+d (that is, each term equals the difference between its previous and next terms divided by 22, then plus dd). At this point, I told MC the first term A1A_1 and the last term AnA_n of an nn-term sequence, as well as dd. The rest is up to you!

Input Format

The first line contains two integers n,mn, m.

The second line contains three real numbers, in order: d,A1,And, A_1, A_n.

Output Format

Output a real number AmA_m, rounded to 33 decimal places.

53 23
0.543 1.213 9768.134

0.543

Hint

Constraints: 1n601 \le n \le 60, 0mn0 \le m \le n, d,A1,An<104|d|, |A_1|, |A_n| < 10^4.

Translated by ChatGPT 5