#P3802. 小魔女帕琪

    ID: 2738 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>洛谷原创排列组合条件概率期望

小魔女帕琪

Description

Now Patchouli has encountered the powerful Queen of the Night, the vampire Remi. The Queen of the Night has extremely strong vitality, so ordinary magic has little effect. Only the ultimate spell, Patchouli's Septet, can deal damage to Remi. The trigger condition for Patchouli's Septet is: among any consecutive 77 spells, if the attributes are all different, Patchouli's Septet is triggered once.

Please note that regardless of whether the previous 66 spells have already been part of an ultimate cast, as long as any consecutive 77 spells have pairwise different attributes, another ultimate is triggered. For example, if we use indices to represent attributes and the casting sequence is 1,2,3,4,5,6,7,11, 2, 3, 4, 5, 6, 7, 1, then the first 77 spells trigger the ultimate once, and the last 77 spells trigger it once again.

Now Patchouli has energy crystals of 77 attributes. The ii-th type of crystal can cast a spell of attribute ii, and there are aia_i crystals in total. Each time a spell is cast, one of the existing energy crystals is consumed uniformly at random, and then a spell of the corresponding attribute is released.

Patchouli wants to know the expected number of times she triggers Patchouli's Septet. She cannot compute it, so she turns to you, an OI student, for help.

Input Format

A single line with 77 integers. The ii-th integer is aia_i.

Output Format

Output a single real number: the answer, rounded to three decimal places.

1 1 1 1 1 1 1
1.000

Hint

  • Sample 1 Explanation: Obviously, Patchouli's Septet will be triggered once.

  • Constraints:

    • For 30%30\% of the testdata, it is guaranteed that i=17ai10\sum_{i = 1}^7 a_i \leq 10.
    • For 100%100\% of the testdata, it is guaranteed that 0ai1090 \leq a_i \leq 10^9 and i=17ai109\sum_{i = 1}^7 a_i \leq 10^9.

Translated by ChatGPT 5