#K68962. Overtime Pay Calculation
Overtime Pay Calculation
Overtime Pay Calculation
You are tasked with calculating the total overtime pay for a group of employees. Each employee is paid based on the number of overtime hours worked:
- If an employee works more than 8 hours but up to 12 hours, the overtime pay is given by \( (\text{hours} - 8) \times X \).
- If an employee works more than 12 hours, then the overtime is split into two parts: for the first 4 overtime hours (hours 9 to 12), the pay is \(4 \times X\), and for any hour beyond 12, the pay is \( (\text{hours} - 12) \times Y \). That is, the formula is \( 4X + (\text{hours} - 12)Y \) for hours \(> 12\).
- If the employee works 8 hours or less, no overtime pay is awarded.
Given the number of employees \(N\), two rates \(X\) and \(Y\), and a list of the hours worked by each employee, compute the total overtime pay.
inputFormat
The input is read from standard input (stdin) and consists of two lines:
- The first line contains three space-separated integers: \(N\) (the number of employees), \(X\) (the overtime rate for hours between 8 and 12), and \(Y\) (the overtime rate for hours beyond 12).
- The second line contains \(N\) space-separated integers representing the number of hours each employee worked.
outputFormat
Output a single integer representing the total overtime pay for all employees. The result should be printed to standard output (stdout).
## sample5 10 15
9 8 10 13 12
125