/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
高橋君はある会社の経理担当です。この会社では N 人のアルバイトスタッフが働いており、それぞれ番号 1 から N が付けられています。
ある月に、スタッフ i は C_i 回のシフトに入りました。
会社は、各スタッフに対してシフト 1 回あたり P 円の基本給を支払います。ただし、月間シフト回数が K 回以上であるスタッフには、そのスタッフの全シフトに対して、基本給に加えてシフト 1 回あたり B 円の特別手当が上乗せされます。すなわち、月間シフト回数が K 回以上のスタッフにはシフト 1 回あたり合計 P + B 円が、K 回未満のスタッフにはシフト 1 回あたり P 円が支払われます。
N 人のスタッフ全員に支払う給料の合計額を求めてください。
制約
- 1 \leq N \leq 100
- 1 \leq P \leq 1000
- 1 \leq B \leq 1000
- 1 \leq K \leq 31
- 1 \leq C_i \leq 31 (1 \leq i \leq N)
- 入力はすべて整数である
入力
N P B K C_1 C_2 \ldots C_N
- 1 行目には、スタッフの人数を表す N 、シフト 1 回あたりの基本給を表す P 、シフト 1 回あたりの特別手当の額を表す B 、特別手当が適用される月間シフト回数の閾値を表す K が、スペース区切りで与えられる。
- 2 行目には、各スタッフの月間シフト回数を表す C_1, C_2, \ldots, C_N が、スペース区切りで与えられる。
出力
会社が N 人のスタッフ全員に支払う給料の合計額を 1 行で出力せよ。
入力例 1
3 100 50 3 5 2 3
出力例 1
1400
入力例 2
3 200 100 10 3 5 2
出力例 2
2000
入力例 3
10 500 300 15 20 10 15 8 25 14 16 5 30 12
出力例 3
109300
入力例 4
20 1000 500 20 25 18 31 20 10 15 22 28 19 30 5 12 21 27 16 8 24 31 14 20
出力例 4
535500
入力例 5
1 1 1 1 1
出力例 5
2
Score : 200 pts
Problem Statement
Takahashi is an accountant at a company. This company has N part-time staff members, each numbered from 1 to N.
In a certain month, staff member i worked C_i shifts.
The company pays each staff member a base pay of P yen per shift. However, for staff members whose monthly shift count is K or more, a special bonus of B yen per shift is added on top of the base pay for all of that staff member's shifts. In other words, staff members with K or more monthly shifts are paid a total of P + B yen per shift, while staff members with fewer than K shifts are paid P yen per shift.
Find the total salary to be paid to all N staff members.
Constraints
- 1 \leq N \leq 100
- 1 \leq P \leq 1000
- 1 \leq B \leq 1000
- 1 \leq K \leq 31
- 1 \leq C_i \leq 31 (1 \leq i \leq N)
- All input values are integers
Input
N P B K C_1 C_2 \ldots C_N
- The first line contains N representing the number of staff members, P representing the base pay per shift, B representing the special bonus amount per shift, and K representing the threshold of monthly shift count for the special bonus to apply, separated by spaces.
- The second line contains C_1, C_2, \ldots, C_N representing the monthly shift count of each staff member, separated by spaces.
Output
Print the total salary the company pays to all N staff members on a single line.
Sample Input 1
3 100 50 3 5 2 3
Sample Output 1
1400
Sample Input 2
3 200 100 10 3 5 2
Sample Output 2
2000
Sample Input 3
10 500 300 15 20 10 15 8 25 14 16 5 30 12
Sample Output 3
109300
Sample Input 4
20 1000 500 20 25 18 31 20 10 15 22 28 19 30 5 12 21 27 16 8 24 31 14 20
Sample Output 4
535500
Sample Input 5
1 1 1 1 1
Sample Output 5
2