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.


-----Examples-----
Input
4 5 5 3 5
1 5 5 4

Output
20

Input
5 3 1 1 3
2 2 2 1 1

Output
15

Input
5 5 3 4 5
1 2 3 4 5

Output
35



-----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.

Source: codeforces | Difficulty: EASY
Tags: Mathematics


Solutions:
def solution(n, a, b, c, t, messages):
	account = 0
	for m in messages:
		if b >= c:
			account += a
		else:
			account += (c - b) * (t - m) + a
	return account
(n, a, b, c, t) = list(map(int, input().split()))
messages = list(map(int, input().split()))
print(solution(n, a, b, c, t, messages))


(n, A, B, C, T) = map(int, input().split())
time = map(int, input().split())
summ = 0
for i in time:
	if C >= B:
		summ += (T - i) * (C - B) + A
	else:
		summ += A
print(summ)


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [0] * a[4]
for i in range(a[4]):
	cost = a[1]
	for j in range(i, a[4]):
		if cost > c[i]:
			c[i] = cost
		cost = cost - a[2] + a[3]
d = [0] * a[4]
for i in range(a[0]):
	d[b[i] - 1] += 1
ans = 0
for i in range(a[4]):
	ans += c[i] * d[i]
print(ans)


(n, A, B, C, T) = map(int, input().split())
t = list(map(int, input().split()))
if B > C:
	print(n * A)
else:
	c = 0
	t.sort()
	for i in t:
		c += (T - i) * (C - B) + A
	print(c)


(n, a, b, c, t) = map(int, input().split())
arr = list(map(int, input().split()))
if b < c:
	ans = 0
	for i in range(n):
		ans += a + (c - b) * (t - arr[i])
	print(ans)
else:
	ans = 0
	for i in range(n):
		ans += a
	print(ans)


(n, a, b, c, T) = map(int, input().split())
t = list(map(int, input().split()))
smth = [0] * T
for i in range(len(t)):
	smth[t[i] - 1] += 1
ans1 = 0
ans2 = 0
for i in range(len(t)):
	ans1 += a
k = 0
for i in range(T):
	ans2 += c * k
	k += smth[i]
for i in range(len(t)):
	ans2 += a - (T - t[i]) * b
print(max(ans1, ans2))


(n, A, B, C, T) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
bank_acount = 0
for i in range(len(t)):
	bank_acount += A
	if C >= B:
		bank_acount += (C - B) * (T - t[i])
print(bank_acount)


(n, a, b, c, t) = (int(x) for x in input().split())
times = [int(x) for x in input().split()]
if c < b:
	print(len(times) * a)
else:
	ans = 0
	for ti in times:
		ans += (t - ti) * (c - b) + a
	print(ans)


(n, a, b, c, t) = map(int, input().split())
s = 0
for x in list(map(int, input().split())):
	s += t - x
print(n * a if b >= c else n * a + s * (c - b))


(n, a, b, c, t) = map(int, input().split())
messages = list(map(int, input().split()))
if b < c:
	money = n * a
	for m in messages:
		money += (t - m) * (c - b)
else:
	money = n * a
print(money)


(n, A, B, C, T) = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = n * A
if C - B > 0:
	for i in t:
		ans += (C - B) * (T - i)
print(int(ans))


(n, a, b, c, T) = map(int, input().split())
ts = list(map(int, input().split()))
ans = 0
for t1 in ts:
	if b > c:
		ans += a
	else:
		lt = T - t1
		ans += a - lt * b + lt * c
print(ans)


rd = lambda : map(int, input().split())
(n, a, b, c, t) = rd()
print(sum(map(lambda x: (t - x) * (c - b) + a, rd())) if c > b else a * n)


(n, a, b, c, t) = map(int, input().split())
lst = []
for x in input().split():
	lst.append(int(x))
if b > c:
	print(n * a)
else:
	acc = 0
	for x in lst:
		acc += t - x
	acc *= c - b
	acc += n * a
	print(acc)


(n, A, B, C, T) = map(int, input().split())
t = list(map(int, input().split()))
score = 0
if C > B:
	for tmp in t:
		score += A + (T - tmp) * (C - B)
else:
	score += n * A
print(score)


(n, a, b, c, t) = map(int, input().split())
v = sorted(list(map(int, input().split())))
ans = 0
for i in v:
	if i > t:
		break
	if c > b:
		ans += (t - i) * (c - b) + a
	else:
		ans += a
print(ans)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def main():
	(n, a, b, c, tt) = [int(x) for x in input().split()]
	t = [int(x) for x in input().split()]
	s = a * n
	if c > b:
		for ti in t:
			s += (c - b) * (tt - ti)
	print(s)
main()


(N, A, B, C, T) = map(int, input().split())
src = list(map(int, input().split()))
ans = A * N
if C - B > 0:
	for a in src:
		ans += (C - B) * (T - a)
print(ans)


(n, A, B, C, T) = input().split()
n = int(n)
A = int(A)
B = int(B)
C = int(C)
T = int(T)
ts = [int(t) for t in input().split()]
ans = A * n
dp = 0
for i in range(n):
	dp = max(dp, dp + (C - B) * (T - ts[i]))
ans += dp
print(ans)


(n, a, b, c, t) = map(int, input().split())
s = sum(map(int, input().split()))
print(max(a * n - (t * n - s) * b + (n * t - s) * c, a * n))


(n, a, b, c, t) = map(int, input().split())
ar = list(map(int, input().split()))
an = n * a
if c - b > 0:
	for j in range(n):
		an = an + (t - ar[j]) * (c - b)
print(an)


(n, A, B, C, T) = [int(a) for a in input().split()]
t = [int(a) for a in input().split()]
if B > C:
	print(len(t) * A)
	exit(0)
s = 0
for i in t:
	s += A + (C - B) * (T - i)
print(s)


R = lambda : map(int, input().split())
(n, A, B, C, T) = R()
print(sum((A + max(0, C - B) * (T - t) for t in R())))


(n, A, B, C, T) = map(int, input().split())
s = T * n - sum(map(int, input().split()))
ans = A * n
if C > B:
	ans += (C - B) * s
print(ans)


from sys import stdin, stdout
import cProfile, math
from collections import Counter
printHeap = str()
test = False
memory_constrained = False

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def test_print(output):
	if test:
		stdout.write(str(output) + '\n')

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def main():
	(n, a, b, c, T) = get_tuple()
	li = get_list()
	if b >= c:
		print(a * n)
	else:
		print(a * n + (T * n - sum(li)) * (c - b))
cProfile.run('main()') if test else main()


R = lambda : map(int, input().split())
(n, A, B, C, T) = R()
s = 0
for t in R():
	a = (T - t) * (C - B) if B < C else 0
	s += A + a
print(s)


(n, a, b, c, t) = map(int, input().split())
tt = [t - int(i) for i in input().split()]
ans = 0
if b >= c:
	print(a * n)
else:
	print(sum(tt) * (c - b) + a * n)


(n, a, b, c, d) = map(int, input().split())
print(sum((max(a - (d - i) * b + (d - i) * c, a) for i in map(int, input().split()))))


(n, originCost, decCost, remainCost, T) = list(map(int, input().split()))
msgTime = [*list(map(int, input().split()))]
result = 0
for i in range(len(msgTime)):
	nextCost = (T - msgTime[i]) * remainCost + (originCost - decCost * (T - msgTime[i]))
	result += max(nextCost, originCost)
print(result)


from math import floor
s = input().split()
n = int(s[0])
A = int(s[1])
B = int(s[2])
C = int(s[3])
T = int(s[4])
s = input().split()
t = list(map(lambda x: int(x), s))
res = 0
if C - B <= 0:
	print(n * A)
	exit(0)
t = list(map(lambda x: A + (C - B) * (T - x), t))
print(sum(t))


(n, a, b, c, t) = input().split()
n = int(n)
a = int(a)
b = int(b)
c = int(c)
t = int(t)
s = input()
s = s.split()
s = [int(x) for x in s]
sum = 0
if b >= c:
	print(a * n)
else:
	for i in s:
		sum += (t - i) * (c - b) + a
	print(sum)


(n, A, B, C, T) = [int(i) for i in input().split(' ')]
t_list = [int(i) for i in input().split(' ')]
if B > C:
	print(n * A)
else:
	bank = 0
	for time in t_list:
		bank += A - (T - time) * B + (T - time) * C
	print(bank)


l = list(map(int, input().split()))
n = l[0]
A = l[1]
B = l[2]
C = l[3]
T = l[4]
l = []
l = list(map(int, input().split()))
l.sort()
sum = A * n
if C > B:
	for i in l:
		sum += (C - B) * (T - i)
print(sum)


(n, a, b, c, t) = map(int, input().split(' '))
s = map(int, input().split(' '))
s = list(s)
sum = n * a
for i in range(0, n):
	if b < c:
		sum += (t - s[i]) * (c - b)
print(sum)


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	c = dict(Counter(l))
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieveForSmallestPrimeFactor():
	MAXN = 100001
	spf = [0 for i in range(MAXN)]
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, math.ceil(math.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
	return spf

def getPrimeFactorizationLOGN(x):
	spf = sieveForSmallestPrimeFactor()
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def si():
	return input()

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def solve():
	(n, a, b, c, t) = li()
	ti = li()
	if b > c:
		print(n * a)
	else:
		ans = 0
		ti.sort()
		for i in ti:
			ans += (t - i) * (c - b) + a
		print(ans)
t = 1
for _ in range(t):
	solve()


def main():
	(n, A, B, C, T) = map(int, input().split())
	res = (n * T - sum(map(int, input().split()))) * (C - B) if C > B else 0
	print(res + A * n)
main()


(n, A, B, C, T) = map(int, input().split())
a = list(map(int, input().split()))
money = 0

def shouldReadSoon(t):
	later = A - B * (T - t)
	laterCost = later + C * (T - t)
	if laterCost > A:
		return laterCost
	else:
		return A
for j in range(len(a)):
	money += shouldReadSoon(a[j])
print(money)


(n, A, B, C, T) = map(int, input().split())
l = list(map(int, input().split()))
t = 0
d = {}
s = 0
for i in range(n):
	if C > B:
		s = s + A + (C - B) * (T - l[i])
	else:
		s = s + A
print(s)


(n, a, b, c, t) = map(int, input().split())
mes = [int(i) for i in input().split()]
if c > b:
	for i in range(n):
		mes[i] = t - mes[i]
	print(a * n - sum(mes) * b + sum(mes) * c)
else:
	print(n * a)


(n, a, b, c, t) = map(int, input().split())
l = [int(i) for i in input().split()]
if b >= c:
	print(n * a)
else:
	print(sum([a + (t - j) * (c - b) for j in l]))


(n, A, B, C, T) = map(int, input().split())
M = [int(x) for x in input().split()]
c = 0
for i in M:
	tr = T - i
	ct = A - B * tr
	ce = C * tr
	ti = A
	c += max(ct + ce, A)
print(c)


import sys
import math
(n, a, b, c, T) = map(int, input().split())
t = list(map(int, input().split()))
sum = n * a
for i in range(n):
	sum += (T - t[i]) * (c - b)
if b > c:
	print(n * a)
else:
	print(sum)


(a, b, c, d, e) = map(int, input().split())
k = list(map(int, input().split()))
k.sort()
i = 0
x = 0
while i < len(k):
	if k[i] <= e:
		if d > c:
			x = x + b + (d - c) * (e - k[i])
		else:
			x = x + b
	else:
		break
	i = i + 1
print(x)


from typing import Dict, List, Tuple

def input_lst() -> List[int]:
	return [int(x) for x in input().split()]

def print_out(res: List[int]):
	print(' '.join([str(x) for x in res]))

def main():
	(n, a, b, c, T) = (int(x) for x in input().split())
	times = input_lst()
	if b >= c:
		res = a * n
	else:
		res = 0
		for time in times:
			least_time = T - time
			res += least_time * c + a - least_time * b
	print(res)
main()


n = list(map(int, input().split()))
a = list(map(int, input().split()))
if n[2] >= n[3]:
	print(n[0] * n[1])
else:
	print(n[0] * n[1] + (n[4] * n[0] - sum(a)) * (n[3] - n[2]))


(n, a, b, c, t) = [int(x) for x in input().split()]
data = [int(x) for x in input().split()]
if b > c:
	print(a * n)
else:
	ans = 0
	for x in data:
		ans += a + (c - b) * (t - x)
	print(ans)


(n, a, b, c, t) = [int(x) for x in input().split()]
s = 0
for i in [int(x) for x in input().split()]:
	s += max(a, a - b * (t - i) + c * (t - i))
print(s)


(n, A, B, C, T) = map(int, input().split())
t_list = list(map(int, input().split()))
if C <= B:
	print(n * A)
else:
	ans = 0
	for ti in t_list:
		ans += (T - ti) * (C - B) + A
	print(ans)


(n, A, B, C, T) = map(int, input().split())
t = sum(list(map(int, input().split())))
if C - B < 0:
	print(n * A)
else:
	print(n * A + (C - B) * (n * T - t))


(n, a, b, c, t) = [int(x) for x in input().split()]
ns = [int(x) for x in input().split()]
if b > c:
	print(n * a)
else:
	ans = n * a
	for i in ns:
		ans += (t - i) * (c - b)
	print(ans)


(n, a, b, c, t) = [int(i) for i in input().split(' ')]
ans = 0
lis = [int(i) for i in input().split(' ')]
if b >= c:
	ans = n * a
else:
	for i in lis:
		ans += c * (t - i) + a - b * (t - i)
print(ans)


def main():
	(n, a, b, c, time) = map(int, input().split())
	t = list(map(int, input().split()))
	res = [0] * n
	acc = k = 0
	while time:
		for i in range(n):
			t[i] -= 1
			if t[i] < 0:
				k += 1
		acc += c * k
		time -= 1
		k = 0
	for i in range(n):
		acc += a + b * t[i]
	print(max(acc, n * a))
main()


(n, A, B, C, T) = [int(x) for x in input().split()]
t = sorted([int(x) for x in input().split()], reverse=True)
k = 0
c = 0
standby = B < C
for i in range(1, T + 1):
	m = 0
	while t != [] and t[-1] == i:
		m += 1
		t.pop()
	if standby and i != T:
		k += m
		c += A * m - (B - C) * k
	else:
		c += A * m
print(c)


(n, A, B, C, T) = map(int, input().split())
arr = map(int, input().split())
print(A * n + ((C - B) * (n * T - sum(arr)) if B < C else 0))


(n, A, B, C, T) = list(map(int, input().split()))
t = list(map(int, input().split()))
t.sort()
if C - B > 0:
	res = sum(map(lambda x: A + (C - B) * (T - x), t))
else:
	res = A * len(t)
print(res)


(n, a, b, c, t) = map(int, input().split())
ans = n * a
s = list(map(int, input().split()))
for i in s:
	if b < c:
		ans += (c - b) * (t - i)
print(ans)


(n, a, b, c, t) = map(int, input().split())
msg = [int(x) for x in input().split()]
if b >= c:
	print(a * n)
else:
	ret = 0
	for ti in msg:
		ret += a + (t - ti) * (c - b)
	print(ret)


(n, a, b, c, t) = [int(x) for x in input().split()]
array = [int(x) for x in input().split()]
ret = 0
if b < c:
	for i in array:
		ret += c * (t - i) + a - (t - i) * b
	print(ret)
else:
	print(n * a)


s = input()
in1 = s.split(' ')
n = int(in1[0])
A = int(in1[1])
B = int(in1[2])
C = int(in1[3])
T = int(in1[4])
s = input()
li = list(map(int, s.split(' ')))
rcv_unread = 0
rcv_reading = 0
if B > C:
	rcv_unread = 0
	rcv_reading = len(li) * A
else:
	for x in li:
		rcv_unread += (T - x) * C
		rcv_reading += A - (T - x) * B
print(rcv_reading + rcv_unread)


(n, a, b, c, T) = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
if b >= c:
	ans = n * a
else:
	li = [0] * (T + 1)
	for i in arr:
		li[i] += 1
	for i in range(1, T + 1):
		li[i] += li[i - 1]
	li[T] = 0
	ans = sum(li) * c
	for i in arr:
		ans += a - (T - i) * b
print(ans)


def main() -> None:
	(n, a, b, c, t) = (int(x) for x in input().split())
	s = 0
	for item in input().split():
		s += t - int(item)
	if b < c:
		print(n * a + s * (c - b))
	else:
		print(n * a)
main()


(n, a, b, c, T) = map(int, input().split())
arr = list(map(int, input().split()))
Tcnt = arr.count(T)
l = n - Tcnt
ans = 0
a1 = 0
for i in range(1, T):
	for j in range(n):
		if arr[j] <= i:
			a1 += 1
	ans += a1 * c
	a1 = 0
b1 = 0
for i in range(n):
	b1 = a - (T - arr[i]) * b
	if b1 <= 0:
		ans += b1
	else:
		ans += b1
ans1 = n * a
print(max(ans, ans1))


(n, a, b, c, t) = map(int, input().split())
lists = list(map(int, input().split()))
print(max(n * a, a * n + (c - b) * (t * n - sum(lists))))


(n, A, B, C, T) = map(int, input().split())
t = list(map(int, input().split()))
first = n * A
s1 = sum([T - el for el in t]) * C
s2 = sum([A - B * (T - el) for el in t])
second = s1 + s2
print(max(first, second))


(n, A, B, C, T) = input().split()
(n, A, B, C, T) = (int(n), int(A), int(B), int(C), int(T))
ti = [int(i) for i in input().split()]
s = 0
if B >= C:
	s = n * A
else:
	for i in ti:
		s += A + (C - B) * (T - i)
print(s)


f = lambda : map(int, input().split())
(n, A, B, C, T) = f()
print(sum((A + max(0, C - B) * (T - x) for x in f())))


(n, a, b, c, t) = map(int, input().split())
tl = list(map(int, input().split()))
ans = a * n
for i in tl:
	ans += max((c - b) * (t - i), 0)
print(ans)


def messages(lst, a, b, c, t):
	result = a * len(lst)
	if b < c:
		for i in range(len(lst)):
			result += (c - b) * (t - lst[i])
	return result
(n, A, B, C, T) = [int(i) for i in input().split()]
z = [int(j) for j in input().split()]
print(messages(z, A, B, C, T))


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
(n, A, B, C, T) = rint()
t = list(rint())
D = C - B
if D < 0:
	print(n * A)
else:
	sum = A * n
	for i in range(n):
		sum += D * (T - t[i])
	print(sum)


(n, a, b, c, t) = map(int, input().split())
ans = 0
d = list(map(int, input().split()))
print(max((c - b) * (t * n - sum(d)), 0) + a * n)


(n, a, b, c, t) = [int(i) for i in input().split()]
if b >= c:
	print(a * n)
else:
	p = a * n
	for x in [int(i) for i in input().split()]:
		p += (t - x) * (c - b)
	print(p)


(n, A, B, C, T) = map(int, input().split())
s = 0
for i in map(int, input().split()):
	s += A
	if C > B:
		s += (C - B) * (T - i)
print(s)


(n, a, b, c, t) = list(map(int, input().split()))
print(sum([max(a + (c - b) * max(0, t - m), a) for m in list(map(int, input().split()))]))


(n, a, b, c, t) = map(int, input().split())
tim = list(map(int, input().split()))
if c > b:
	s = sum([a + (t - ti) * (c - b) for ti in tim])
else:
	s = a * n
print(s)


(n, A, B, C, T) = map(int, input().split())
if B >= C:
	print(A * n)
else:
	S = 0
	arr = [int(x) for x in input().split()]
	for i in range(n):
		S += (T - arr[i]) * (C - B)
	S += n * A
	print(S)


(n, A, B, C, T) = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
res = n * A
if C - B <= 0:
	print(res)
else:
	res += sum([(C - B) * (T - x) for x in a])
	print(res)


(n, a, b, c, d) = map(int, input().split())
t = map(int, input().split())
ans = n * a + sum(map(lambda x: d - x, t)) * max(c - b, 0)
print(ans)


(n, A, B, C, T) = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = A * n
if B < C:
	for time in t:
		ans += (T - time) * (C - B)
print(ans)


(n, a, b, c, T) = map(int, input().split())
ts = list(map(int, input().split()))
ts.sort()
ans = 0
for t in ts:
	temp = -10 ** 18
	for u in range(t, T + 1):
		temp = max(temp, c * (u - t) + a - b * (u - t))
	ans += temp
print(ans)


(n, a, b, c, t) = map(int, input().split())
u = list(map(int, input().split()))
if b >= c:
	x = n * a
	print(x)
else:
	print(n * a + (n * t - sum(u)) * (c - b))


(n, a, b, c, T) = map(int, input().split())
t = list(map(int, input().split()))
if c <= b:
	print(n * a)
else:
	cur = 0
	dif = c - b
	for i in t:
		cur += T - i
	print(dif * cur + n * a)


(n, A, B, C, T) = map(int, input().split())
t = [int(i) for i in input().split()]
t.sort()
total_sum = 0
for lower_border in range(n + 1):
	candidate = n * A
	for (counter, ind) in enumerate(range(lower_border, n)):
		if counter != 0:
			candidate -= ind * (t[ind] - t[ind - 1]) * B
			candidate += ind * (t[ind] - t[ind - 1]) * C
	candidate -= (n - lower_border) * (T - t[-1]) * B
	candidate += (n - lower_border) * (T - t[-1]) * C
	total_sum = candidate if candidate > total_sum else total_sum
print(total_sum)


l = list(map(int, input().split()))
a = list(map(int, input().split()))
Cost = 0
if l[2] >= l[3]:
	print(l[0] * l[1])
else:
	S = 0
	Cost = l[0] * l[1]
	for i in a:
		S += l[4] - i
	S *= l[3] - l[2]
	print(Cost + S)


def inpmap():
	return list(map(int, input().split()))
(n, a, b, c, t) = inpmap()
arr = inpmap()
if b >= c:
	print(a * n)
else:
	s = 0
	for x in arr:
		s += a - (t - x) * b
		s += (t - x) * c
	print(s)


(n, a, b, c, t) = map(int, input().split())
l = list(map(int, input().split()))
f = [0] * 1001
for i in l:
	f[i] -= -1
tmp = 0
tmp2 = 0
for i in range(1, t):
	tmp += (t - i) * f[i]
tmp = n * a + tmp * c - tmp * b
print(max(n * a, tmp))


l = list(map(int, input().split()))
n = l[0]
A = l[1]
B = l[2]
C = l[3]
T = l[4]
l = []
l = list(map(int, input().split()))
l.sort()
if C > B:
	k = 0
	sum = 0
	for i in range(T):
		if k < n and l[k] == i:
			k += l.count(l[k])
		sum += (C - B) * k
	print(n * A + sum)
else:
	print(n * A)


(n, A, B, C, T) = map(int, input().split())
t = sum(map(int, input().split()))
print(max(n * A - (T * n - t) * B + (n * T - t) * C, n * A))


(n, A, B, C, T) = map(int, input().split())
t = list(map(int, input().split()))
if C <= B:
	print(len(t) * A)
else:
	total = 0
	for ti in t:
		total += A + (T - ti) * (C - B)
	print(total)


n = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
if n[2] >= n[3]:
	print(n[0] * n[1])
else:
	for i in t:
		if i == n[4]:
			ans += n[1]
		else:
			ans += n[1] + (n[4] - i) * (n[3] - n[2])
	print(ans)


(n, a, b, c, t) = list(map(int, input().split()))
time = list(map(int, input().split()))
ans = 0
if c >= b:
	for ti in time:
		ans += a + (c - b) * (t - ti)
else:
	ans = len(time) * a
print(ans)


(n, A, B, C, T) = map(int, input().split())
d = list(map(int, input().split()))
d.sort()
answer = 0
prev = 0
for i in range(n):
	if d[i] <= T:
		answer += A + (T - d[i]) * max(0, C - B)
print(answer)


(n, a, b, c, t) = [int(i) for i in input().split()]
if b >= c:
	print(a * n)
else:
	times = [int(i) for i in input().split()]
	r = 0
	for time in times:
		r += (t - time) * c
		r += a - b * (t - time)
	print(r)


string = input().split(' ')
n = int(string[0])
a = int(string[1])
b = int(string[2])
c = int(string[3])
t = int(string[4])
sum1 = n * a
line = input().split(' ')
for i in range(n):
	k = int(line[i])
	if b < c:
		sum1 = sum1 + (c - b) * (t - k)
print(sum1)


lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
n = lst1[0]
A = lst1[1]
B = lst1[2]
C = lst1[3]
T = lst1[4]
bank_initial = 0
sonda_oku = False
basta_oku = False
if C > B:
	sonda_oku = True
else:
	basta_oku = True
for i in lst2:
	if basta_oku:
		bank_initial += A
	else:
		bank_initial += A - B * (T - i) + C * (T - i)
print(bank_initial)


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, a, b, c, s) = zz()
l = zz()
t = 0
m = 0
for i in l:
	t += a + max(0, (c - b) * (s - i))
print(t)


a = input()
b = input()
a = a.split(' ')
b = b.split(' ')
for i in range(len(a)):
	a[i] = int(a[i])
for i in range(len(b)):
	b[i] = int(b[i])

def masaza():
	x = 0
	if a[2] >= a[3]:
		print(a[0] * a[1])
	else:
		for i in range(a[0]):
			x += (a[3] - a[2]) * (a[4] - b[i])
		x += a[0] * a[1]
		print(x)
masaza()


(n, A, B, C, T) = [int(item) for item in input().split()]
t = [int(item) for item in input().split()]
if C <= B:
	res = n * A
else:
	res = n * A + (C - B) * (n * T - sum(t))
print(res)


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
(n, A, B, C, T) = mints()
r = A * n
if C > B:
	for i in mints():
		r += (T - i) * (C - B)
print(r)


k = input().split()
(n, a, b, c, t) = [int(k[i]) for i in range(5)]
time = list(map(int, input().split()))
if c <= b:
	print(len(time) * a)
else:
	delta = c - b
	count = 0
	for i in time:
		count += t - i
	countf = delta * count
	print(countf + len(time) * a)


(n, A, B, C, T) = map(int, input().split())
t = map(int, input().split())
s = A * n
if C > B:
	s += sum(((T - x) * (C - B) for x in t))
print(s)


(n, A, B, C, T) = map(int, input().strip().split())
t = list(map(int, input().strip().split()))
if B >= C:
	res = n * A
else:
	res = 0
	for e in t:
		res += A + (T - e) * (C - B)
print(res)


read = lambda : map(int, input().split())
(n, A, B, C, T) = read()
print(n * A + (C - B) * sum((T - x for x in read())) if C > B else n * A)


rd = lambda : list(map(int, input().split()))
(n, a, b, c, t) = rd()
y = list(rd())
print(sum([t * (c - b) + x * (b - c) + a for x in y]) if c > b else a * n)


def process_immediately(arr, A, B, C, T):
	return len(arr) * A

def process_all_at_end(arr, A, B, C, T):
	return sum([A + (T - x) * (C - B) for x in arr])
(n, A, B, C, T) = [int(x) for x in input().strip(' ').split(' ')]
arr = [int(x) for x in input().strip(' ').split(' ')]
print(max(process_all_at_end(arr, A, B, C, T), process_immediately(arr, A, B, C, T)))


(n, a, b, c, t) = map(int, input().split())
arr = list()
arr = map(int, input().split())
Sum = int(0)
for num in arr:
	Sum += t - num
ans = n * a
if b >= c:
	print(ans)
else:
	print(ans + Sum * int(c - b))


(n, a1, b1, c1, t) = map(int, input().split())
r = list(map(int, input().split()))
if c1 <= b1:
	print(n * a1)
else:
	s = 0
	for i in r:
		s += (c1 - b1) * (t - i)
	print(s + n * a1)


def be(k, delta, T, A):
	s = len(k)
	print(s * A)

def ce(k, delta, T, A):
	s = 0
	for i in k:
		s = s - delta * (T - i) + A
	print(s)
s1 = input()
s2 = input()
s1 = s1.split(' ')
k1 = [int(a) for a in s1]
s2 = s2.split(' ')
k2 = [int(a) for a in s2]
delta = k1[2] - k1[3]
if delta >= 0:
	be(k2, delta, k1[4], k1[1])
else:
	ce(k2, delta, k1[4], k1[1])


(n, A, B, C, T) = map(int, input().split())
t = map(int, input().split())
ans = n * A
if C > B:
	for ti in t:
		ans += (T - ti) * (C - B)
print(ans)


from collections import deque

class CodeforcesTask964BSolution:

	def __init__(self):
		self.result = ''
		self.n_a_b_c_t = []
		self.times = []

	def read_input(self):
		self.n_a_b_c_t = [int(x) for x in input().split(' ')]
		self.times = [int(x) for x in input().split(' ')]

	def process_task(self):
		rec = [0] * self.n_a_b_c_t[4]
		for t in self.times:
			rec[t - 1] += 1
		bank = 0
		unread = deque()
		for moment in range(self.n_a_b_c_t[4]):
			unread.append([rec[moment], self.n_a_b_c_t[1]])
			for x in range(len(unread)):
				dec = unread.popleft()
				now_cost = dec[0] * dec[1]
				later_cost = dec[0] * (dec[1] - self.n_a_b_c_t[2]) + dec[0] * self.n_a_b_c_t[3]
				if now_cost >= later_cost or moment == self.n_a_b_c_t[4] - 1:
					bank += now_cost
				else:
					bank += dec[0] * self.n_a_b_c_t[3]
					dec[1] -= self.n_a_b_c_t[2]
					unread.append(dec)
		self.result = str(bank)

	def get_result(self):
		return self.result
Solution = CodeforcesTask964BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, a, b, c, t) = map(int, input().split())
ti = list(map(int, input().split()))
ans = n * a
if c > b:
	for i in range(n):
		ans += (c - b) * (t - ti[i])
print(ans)


def solve(n, A, B, C, T, time):
	if B > C:
		return A * n
	else:
		max_val = 0
		for t in time:
			max_val += A + (C - B) * t
		return max_val

def main():
	(n, A, B, C, T) = [int(x) for x in input().split()]
	time = [T - int(x) for x in input().split()]
	print(solve(n, A, B, C, T, time))
main()


import queue

def readTuple():
	return input().split()

def readInts():
	return tuple(map(int, readTuple()))

def solve():
	(n, A, B, C, T) = readInts()
	nums = readInts()
	s = 0
	if B >= C:
		print(A * n)
	else:
		for x in nums:
			s += A + (T - x) * (C - B)
		print(s)
	pass
solve()


(n, A, B, C, T) = map(int, input().split())
if C > B:
	ans = 0
	for t in map(int, input().split()):
		ans += A + (C - B) * (T - t)
else:
	ans = A * n
print(ans)


(n, a, b, c, t) = [int(i) for i in input().split()]
ans = 0
for i in [int(i) for i in input().split()]:
	cur = a
	for j in range(i, t + 1):
		cur = max(cur, a - (j - i) * b + c * (j - i))
	ans += cur
print(ans)