#K78852. Calculate Payroll

    ID: 35178 Type: Default 1000ms 256MiB

Calculate Payroll

Calculate Payroll

You are given an employee's hourly wage, the number of hours worked in a week, a threshold of hours that qualifies for a bonus, and an extra per-hour bonus for any hour worked beyond that threshold. The task is to calculate the employee's total weekly earnings.

The calculation is defined as follows:

$$\text{Base\_Pay} = \text{wage} \times \text{hours}$$

If \( \text{hours} > \text{threshold} \), the bonus is given by:

$$\text{Bonus\_Pay} = \text{extra\_bonus} \times (\text{hours} - \text{threshold})$$

Thus, the total pay is:

$$\text{Total\_Pay} = \text{Base\_Pay} + \text{Bonus\_Pay}$$

Make sure your solution reads input from standard input and writes the result to standard output.

inputFormat

The input will consist of a single line containing four space-separated integers:

  • wage: the hourly wage of the employee.
  • hours: the number of hours worked in the week.
  • threshold: the minimum number of hours after which the bonus is applied.
  • extra_bonus: the additional bonus earned for each hour worked beyond the threshold.

outputFormat

Output a single integer representing the total weekly earnings of the employee.

## sample
20 38 35 5
775