#B3988. Monthly Natural Gas Billing

    ID: 11645 Type: Default 1000ms 256MiB

Monthly Natural Gas Billing

Monthly Natural Gas Billing

This problem simulates the calculation of monthly natural gas bills based on a tiered pricing system applied to the cumulative annual usage. The pricing rules are as follows:

  • For a cumulative usage \(0 \leq x \leq 310\) cubic meters, the price is \(3\) yuan per cubic meter.
  • For a cumulative usage \(310 < x \leq 520\) cubic meters, the additional usage is charged at \(3.3\) yuan per cubic meter.
  • For a cumulative usage above \(520\) cubic meters, the additional usage is charged at \(4.2\) yuan per cubic meter.

For example, if the annual usage is \(600\) cubic meters then the total cost is computed as:

[ \text{Cost}(600) = 310 \times 3 + (520 - 310) \times 3.3 + (600 - 520) \times 4.2 = 930 + 693 + 336 = 1959 \text{ yuan} ]

The monthly billing is obtained by computing the cumulative usage up to each month and then taking the difference of the total cost between consecutive months. That is, if \(S_i\) represents the cumulative usage up to month \(i\) and \(C(x)\) is the cost function, then the fee for month \(i\) is:

[ \text{Fee}i = C(S_i) - C(S{i-1}), \quad S_0 = 0. ]

</p>

inputFormat

The input consists of a single line containing 12 space-separated numbers. Each number represents the gas usage (in cubic meters) for a month from January to December.

outputFormat

Output a single line with 12 space-separated numbers. Each number is the gas fee for the corresponding month, calculated based on the cumulative usage up to that month using the tiered pricing system.

sample

0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0