#B3897. Fish Tofu Release Penalty
Fish Tofu Release Penalty
Fish Tofu Release Penalty
In a certain place, there are \( k \) people who have released fish tofu without registration. During an inspection, Aya discovers this unusual situation and stops them. According to the rules set by Aya, each person is fined based on the amount of fish tofu released as follows:
- If a person releases \( \leq 10 \) kilograms of fish tofu, the fine is \( a \) yuan per kilogram.
- For the part exceeding 10 kg and up to 100 kg, the fine is \( b \) yuan per kilogram.
- For any amount beyond 100 kg, the fine is \( c \) yuan per kilogram.
In mathematical terms, if a person releases \( w \) kilograms, the fine \( F(w) \) is calculated as:
$$ F(w)=\begin{cases} a\times w, & \text{if } w\leq 10,\\ a\times 10+b\times (w-10), & \text{if } 10100.\\ \end{cases} $$You are given the number of persons \( k \), the penalty rates \( a, b, c \), and the weight of fish tofu released by each person. Your task is to calculate the total fine to be paid by all individuals.
inputFormat
The first line contains four integers: \( k, a, b, c \) where \( k \) is the number of persons, and \( a, b, c \) are the penalty rates for the first tier, second tier, and third tier respectively.
The second line contains \( k \) integers, where the \( i\)-th integer represents the weight (in kilograms) of fish tofu released by the \( i\)-th person.
outputFormat
Output a single integer representing the total fine that must be paid by all persons.
sample
3 1 2 3
10 20 150
380