atcoder#ABC224G. [ABC224G] Roll or Increment

[ABC224G] Roll or Increment

Score : 600600 points

Problem Statement

We have a NN-face die (singular of dice) that shows integers from 11 through NN with equal probability. Below, the die is said to be showing an integer XX when it is placed so that the top face is the face with the integer XX. Initially, the die shows the integer SS.

You can do the following two operations on this die any number (possibly zero) of times in any order.

  • Pay AA yen (the Japanese currency) to "increase" the value shown by the die by 11, that is, reposition it to show X+1X+1 when it currently shows XX. This operation cannot be done when the die shows NN.
  • Pay BB yen to recast the die, after which it will show an integer between 11 and NN with equal probability.

Consider making the die show TT from the initial state where it shows SS. Print the minimum expected value of the cost required to do so when the optimal strategy is used to minimize this expected value.

Constraints

  • 1N1091 \leq N \leq 10^9
  • 1S,TN1 \leq S, T \leq N
  • 1A,B1091 \leq A, B \leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN SS TT AA BB

Output

Print the answer. Your output will be considered correct when its absolute or relative error is at most 10510^{-5}.

5 2 4 10 4
15.0000000000000000

When the optimal strategy is used to minimize the expected cost, it will be 1515 yen.

10 6 6 1 2
0.0000000000000000

The die already shows TT in the initial state, which means no operation is needed.

1000000000 1000000000 1 1000000000 1000000000
1000000000000000000.0000000000000000

Your output will be considered correct when its absolute or relative error is at most 10510^{-5}.