Under construction

Still being built. Things may change

Blackjack

Time limit4sMemory limit256 MB

Summary
With n cards and limits a < b, compute the best chance to end with total > a and at most b in a randomly shuffled blackjack draw where stopping is allowed.
Level

Medium7 of 10

Topics
Dynamic programming, Probability, Combinatorics
Solved
No attempts yet

Problem

There is a saying: "If you hesitate, you lose the game; if you are decisive, you die in vain."

Calabash does not want to lose the game, and he does not want to die in vain either. That is not important, though, because he does not have enough money to buy the game.

Fortunately, Roundgod, the banker of a casino, gives him a chance to fulfill his dream. Roundgod promises to buy him the game if he can win one round of Blackjack. Blackjack uses a deck of playing cards, each with some number of points. The game proceeds as follows. Roundgod gives a number aa and tells Calabash the number of points on each card. Then Calabash starts drawing cards according to this procedure:

  1. The deck of all cards is shuffled uniformly at random.
  2. Calabash may repeatedly draw a card from the deck (he immediately learns the number of points on the card after drawing it), or declare at any moment that he stops drawing.
  3. If, after drawing any card, the total number of points on the cards Calabash has drawn exceeds a limit bb, he loses immediately.
  4. Otherwise, after Calabash stops drawing, he wins if and only if the total number of points on the cards he has drawn is greater than aa.

Calabash wants to know the probability that he wins if he plays optimally, so that he can obtain his favorite game. Help him calculate this probability.

Input

The input consists of two lines. The first line contains three integers n,a,bn, a, b (1≤n≤500,1≤a<b≤500)(1 \leq n \leq 500, 1 \leq a < b \leq 500), which denote the number of cards in the deck, the number Roundgod gives, and the limit on the total number of points, respectively. The second line contains nn integers x1,x2,⋯ ,xnx_1, x_2, \cdots, x_n (1≤xi≤500)(1 \leq x_i \leq 500), which denote the numbers of points on the cards. It is guaranteed that ∑i=1nxi>b\sum_{i=1}^n x_i > b.

Output

Output the answer with an absolute error of no more than 10−610^{-6}.

Examples2

  1. Example 1

    Input
    5 2 4
    1 1 1 5 5
    
    Expected output
    0.100000000000
    
  2. Example 2

    Input
    5 2 4
    1 1 1 3 5
    
    Expected output
    0.450000000000