eolymp
bolt
Try our new interface for solving problems
Problems

Watermelons

Watermelons

n watermelons lie in a row on the counter. It is known that each watermelon, except the first and the last, is 100 grams lighter than the arithmetic mean of weight of their neighbors.

Find the weight of the m - th watermelon to the nearest gram if the weights of the first and last watermelon are known.

Input

One line contains four numbers:

  • n (2n10000) - the number of watermelons,

  • a, b - the weight of the first and the last watermelon in kilograms (positive real numbers, 0 < a, b109),

  • m - the number of the watermelon which weight should be found (integer, 1mn).

Output

Print the weight of the m - th watermelon in kilograms accurate to the thousandths, or -1 if the problem has no solution.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 1 2.6 2
Output example #1
1.700
Source 2020 XXXIV областная олимиада по информатике, Житомир