TV Show

Special Judge Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

      Charlie is going to take part in one famous TV Show. The show is a single player game. Initially the player has 100 dollars. The player is asked n questions, one after another. If the player answers the question correctly, the sum he has is doubled. If the answer is incorrect, the player gets nothing and leaves the show.
      Before each question the player can choose to leave the show and take away the prize he already has. Also once in the game the player can buy insurance. Insurance costs c dollars which are subtracted from the sum the player has before the question. Insurance has the following effect: if the player answers the question correctly his prize is doubled as usually, if the player answers incorrectly the prize is not doubled, but the game continues. The player must have more than c dollars to buy insurance.
      Charlie’s friend Jerry works on TV so he managed to steal the topics of the questions Charlie will be asked. Therefore for each question i Charlie knows p— the probability that he will answer this question correctly. Now Charlie would like to develop the optimal strategy to maximize his expected prize. Help him.

Input

      The first line of the input file contains two integer numbers n and c (1 ≤ n ≤ 50, 1 ≤ c ≤ 109). The second line contains n integer numbers ranging from 0 to 100 — the probabilities that Charlie will answer questions correctly, in percent.

Output

      Output one real number — the expected prize of Charlie if he follows the optimal strategy. Your answer must have relative or absolute error within 10-8
.

Sample Input

2 100
50 50
2 50
50 50
2 50
60 0

Sample Output

100
112.5
120

Hint

      The optimal strategy in the second example is to take insurance for the second question. In this case the expected prize is 1/2 × 0 + 1/2 × (1/2 × 150 + 1/2 × 300).
      In the third example it is better to leave the show after the first question, because there is no reason to try to answer the second one.

Source

Andrew Stankevich Contest 22

Manager

Information
Solved Number85
Submit Number193
Problem Tags
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel