Watermelons#9607

Watermelons

1 second
128 megabytes
Hard

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

Find the weight of the -th watermelon to the nearest gram (rounded to thousandths of a kilogram) if the weights of the first and last watermelon are known.

Input

One line contains four numbers:

  • (2 \le n \le 10000) - the number of watermelons,

  • - the weight of the first and the last watermelon in kilograms (positive real numbers, 0 < a, b \le 10^9),

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

Output

Print the weight of the -th watermelon in kilograms rounded to thousandths (to the nearest gram), or if the problem has no solution.

Examples

Example 1

Loading
Loading