CF964B Messages

题目描述

------------ Vasya有n封信。第i封信将在ti秒之后接收。 每封信都开始都值a元,但收到消息后,消息的成本每分钟减少B元(B可能变为负数)。Vasya可以在任意时刻接收到任何消息,也可在任意时刻读取它。读完消息后,Vasya的银行账户会收到该消息的当前成本。最初,Vasya的银行账户为0。 同时,每分钟Vasya的银行账户会收到C·k元,k是收到了但未读信的数量。 Vasya非常贪婪(又一个葛朗台),正因为如此,他想让所有的信息在T分钟后被阅读,使其利益最大化。 ------------

输入格式

------------ 第一行输入5个数 n , A , B , C 与 T ( 1

输出格式

------------ ------------ 输出一个整数,问题的答案。

说明/提示

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.