Divar’s Salaries | 프로그래밍의 벗 PivotOJ
PivotOJ

Divar’s Salaries

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC Asia Tehran Regional Contest 2024BOJ 33192

문제

Amin works in the financial department of Divar company. As part of his responsibilities, he needs to prepare the salary payment list for the company’s employees. The salary of each employee is calculated based on a base hourly rate of xx Rials. However, the actual pay rate varies depending on the type of working hours:

  • Normal Working Hours: Paid at the standard rate of xx Rials per hour.
  • Overtime Hours: Any hours worked beyond the standard 140140 hours per month are compensated at 1.51.5 times the base rate.
  • Holiday Hours: Hours worked on recognized holidays are paid at twice the base rate, regardless of whether they fall within or beyond the standard 140140 hours.

Holiday hours always take precedence, and employees are compensated at the doubled rate for these hours, irrespective of the standard working hour limits.

Amin’s task is to calculate the total monthly salary for each employee, taking into account their normal hours, overtime hours, and holiday hours. Help Amin determine the payment for all the employees in the company.

입력

The first line of input contains a single integer nn (1n10001 \le n \le 1\, 000), representing the number of employees in the company. The following nn lines each provide three integers xx, kk and hh, which describe the details for each employee:

  • xx (100x106100 \le x \le 10^6): The hourly wage in Rials, which is always a multiple of 1010.
  • kk (0k4800 \le k \le 480): The total number of hours worked during the current month.
  • hh (0hk0 \le h \le k): The number of holiday hours worked.

출력

In the output, print the total monthly payment for each employee on a separate line. The payment must be formatted with commas separating every three digits, starting from the right.

예제

예제 1

입력
3
500 10 0
200 190 15
10000 150 20
출력
5,000
44,500
1,700,000
코드를 제출하려면 로그인하세요.