Universal Cup Judging System

Universal Cup

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓
الإحصائيات

A lottery event is being held in the Tsukuyomi.

There are $n$ items in the prize pool, and their values are $A_1, A_2, \dots, A_n$.

Kaguya can participate in the lottery for several rounds, but she must participate in at least one round. In each round, the process is as follows:

  1. Kaguya needs to pay the current lottery cost $c$, and then an integer $x$ is chosen uniformly at random from $[1, n]$. She learns which item $x$ was drawn.
  2. After seeing the result, Kaguya has two choices:
    • Keep the $x$-th item and end the entire lottery event. In this case, she will obtain the item with value $A_x$.
    • Give up the currently drawn item and enter the next round of the lottery. However, the lottery cost will increase accordingly, and the cost of the next round will become $c + k$, that is, update $c \leftarrow c + k$.

Kaguya defines the "profit" of this lottery event as the value of the finally obtained item $A_x$ minus the sum of the lottery costs she paid in all rounds.

Assuming Kaguya is smart enough and always takes the optimal strategy to maximize her expected profit, please find the expected profit she can obtain under the optimal strategy.

Input

The first line contains three integers $n, c, k$ ($1 \le n \le 4 \times 10^5, 1 \le c \le 4 \times 10^5, 0 \le k \le 4 \times 10^5$), representing the total number of items in the prize pool, the initial cost of the first lottery round, and the increase in cost for each reroll.

The second line contains $n$ integers $A_1, A_2, \dots, A_n$ ($1 \le A_i \le 4 \times 10^5$), representing the value of each item.

Output

Output one line containing a real number, representing the expected profit under Kaguya's optimal strategy. Your answer is considered correct if and only if the absolute or relative error between your answer and the standard answer does not exceed $10^{-6}$.

Examples

Sample Input 1

3 2 0
4 1 6

Sample Output 1

2.000000000

Sample Input 2

9 8 2
53 71 5 6 80 37 50 33 90

Sample Output 2

51.557786840

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.