#C11562. Weekly Earnings Calculation with Overtime

    ID: 40892 Type: Default 1000ms 256MiB

Weekly Earnings Calculation with Overtime

Weekly Earnings Calculation with Overtime

You are given the number of employees and, for each employee, the number of hours worked in a week and their hourly wage rate. For each employee, if the total working hours \(h\) are at most 40, then the weekly earnings are computed as \(E = h \times r\). If an employee works more than 40 hours, the overtime hours are paid at \(1.5\) times the hourly rate. Thus, the earnings are computed using the formula:

$$ E = \begin{cases} h \times r, & \text{if } h \le 40,\\[8pt] 40 \times r + (h - 40) \times 1.5 \times r, & \text{if } h > 40. \end{cases} $$

Calculate and output the weekly earnings for each employee.

inputFormat

The input is read from standard input and is formatted as follows:

  1. The first line contains an integer \(n\) representing the number of employees.
  2. Each of the next \(n\) lines contains two space-separated integers \(h\) and \(r\), where \(h\) is the number of hours worked in a week and \(r\) is the hourly wage rate.

outputFormat

Output the computed weekly earnings for each employee on a separate line to standard output. Use the overtime formula as described above to compute the earnings.

## sample
3
35 15
50 20
40 25
525

1100 1000

</p>