**Draws "Innervate"**.
"Wow that's lucky for me! All I need to do is to click "'Greater' then getting a free second draw!"
**Sees another "Innervate"**
"Are you sure you want to uninstall Hearthstone from your computer?" "Yes."
uuzlovetree loves playing Hearthstone, and his favorite class is Druid. In Hearthstone, there's a spell for the Druid class called 'Guess the weight,', as shown below.
uuzlovetree knows the number of cards in the deck and knows the mana cost of each card. He wants to know the probability of getting the second card when he plays the 'Guess the weight' under the optimal guessing strategy.
Formally, assume there are currently m cards in the deck, with a number representing mana cost on each card. Now one randomly shuffles all m cards in the deck(each of the m! possible arrangements of the cards appear with equal probability). When one plays the card 'Guess the weight,' he draws the first card of the deck and chooses one of the following two options:
Caution: If the second card of the deck has equal mana cost with the first card, then no matter which option you choose, you cannot draw the second card of the deck.
Initially, there are n≥2 cards in the deck, with mana costs a1,a2,…,an , respectively. Now q events happen to the deck(How can those events happen? Try Hearthstone to find out for yourself!), with each event in one of the following two forms: