#K5151. Employee Bonus Calculation

    ID: 29103 Type: Default 1000ms 256MiB

Employee Bonus Calculation

Employee Bonus Calculation

You are given the scores of three employees and a total bonus pool. Your task is to calculate the exact bonus for each employee. The bonus is distributed in proportion to their performance scores, and the individual bonus amounts are obtained by rounding the computed value to the nearest integer.

For each employee with score \(S_i\) (where \(i = 1, 2, 3\)) and a total bonus pool \(B\), the bonus is calculated using the formula:

[ B_i = \text{round}\left(\frac{S_i}{S_1+S_2+S_3} \times B\right) ]

Given \(T\) test cases, for each test case, you will receive four integers \(S_1\), \(S_2\), \(S_3\), and \(B\) in one line. For each test case, output three integers representing the bonus for each employee.

inputFormat

The first line contains a single integer \(T\) representing the number of test cases. Each of the next \(T\) lines contains four space-separated integers \(S_1\), \(S_2\), \(S_3\), and \(B\), where:

  • \(S_1, S_2, S_3\) denote the performance scores.
  • \(B\) denotes the total bonus pool.

outputFormat

For each test case, print a single line with three space-separated integers \(B_1\), \(B_2\), and \(B_3\) representing the bonus amounts for the three employees, respectively.

## sample
1
1 1 1 300
100 100 100

</p>