CF964B.Messages

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are nn incoming messages for Vasya. The ii -th message is going to be received after tit_{i} minutes. Each message has a cost, which equals to AA initially. After being received, the cost of a message decreases by BB 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 00 .

Also, each minute Vasya's bank account receives CkC·k , where kk 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 TT minutes.

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

输入格式

The first line contains five integers nn , AA , BB , CC and TT ( 1<=n,A,B,C,T<=10001<=n,A,B,C,T<=1000 ).

The second string contains nn integers tit_{i} ( 1<=ti<=T1<=t_{i}<=T ).

输出格式

Output one integer — the answer to the problem.

输入输出样例

  • 输入#1

    4 5 5 3 5
    1 5 5 4
    

    输出#1

    20
    
  • 输入#2

    5 3 1 1 3
    2 2 2 1 1
    

    输出#2

    15
    
  • 输入#3

    5 5 3 4 5
    1 2 3 4 5
    

    输出#3

    35
    

说明/提示

In the first sample the messages must be read immediately after receiving, Vasya receives AA points for each message, nA=20n·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 11 , 22 , 33 , 44 and 00 unread messages at the corresponding minutes, he gets 4040 points for them. When reading messages, he receives (543)+(533)+(523)+(513)+5=5(5-4·3)+(5-3·3)+(5-2·3)+(5-1·3)+5=-5 points. This is 3535 in total.

首页