Tinkoff Internship Warmup Round 2018 and Codeforces Round 475 (Div. 2)
B
Messages
Codeforces
1300
原题
← AC →
翻译中…

There are $*n*$ incoming messages for Vasya. The $*i*$-th message is going to be received after $*t*_{*i*}$ minutes. Each message has a cost, which equals to $*A*$ initially. After being received, the cost of a message decreases by $*B*$ each minute (it can become negative). Vasya can read any message after receiving it at any moment of time. After reading the message, Vasya's bank account receives the current cost of this message. Initially, Vasya's bank account is at $0$.

翻译中…

Also, each minute Vasya's bank account receives $*C*·*k*$, where $*k*$ is the amount of received but unread messages.

翻译中…

Vasya's messages are very important to him, and because of that he wants to have all messages read after $*T*$ minutes.

翻译中…

Determine the maximum amount of money Vasya's bank account can hold after $*T*$ minutes.

翻译中…

Input

翻译中…

The first line contains five integers $*n*$, $*A*$, $*B*$, $*C*$ and $*T*$ ($1 ≤ *n*, *A*, *B*, *C*, *T* ≤ 1000$).

翻译中…

The second string contains $*n*$ integers $*t*_{*i*}$ ($1 ≤ *t*_{*i*} ≤ *T*$).

翻译中…

Output

翻译中…

Output one integer  — the answer to the problem.

翻译中…

Note

翻译中…

In the first sample the messages must be read immediately after receiving, Vasya receives $*A*$ points for each message, $*n*·*A* = 20$ in total.

翻译中…

In the second sample the messages can be read at any integer moment.

翻译中…

In the third sample messages must be read at the moment T. This way Vasya has $1$, $2$, $3$, $4$ and $0$ unread messages at the corresponding minutes, he gets $40$ points for them. When reading messages, he receives $(5 - 4·3) + (5 - 3·3) + (5 - 2·3) + (5 - 1·3) + 5 =  - 5$ points. This is $35$ in total.

翻译中…

样例

Input #1
4 5 5 3 5
1 5 5 4
Output #1
20
InputCopy OutputCopy
Input #2
5 3 1 1 3
2 2 2 1 1
Output #2
15
InputCopy OutputCopy
Input #3
5 5 3 4 5
1 2 3 4 5
Output #3
35
InputCopy OutputCopy
题目信息
题号
964B
时间限制
1 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。