#K56187. Calculate Total Revenue from Transactions

    ID: 30143 Type: Default 1000ms 256MiB

Calculate Total Revenue from Transactions

Calculate Total Revenue from Transactions

You are given a list of transactions where each transaction is represented by three integers: item_id, quantity, and price. Your task is to compute the total revenue generated for each item. The revenue for each transaction is computed as:

\(\text{Revenue} = \text{quantity} \times \text{price}\)

Then, sum up the revenue for transactions with the same item_id and output the results sorted in increasing order of item_id.

If there are no transactions, output nothing.

inputFormat

The input is provided via stdin as follows:

  • The first line contains an integer \(N\), representing the number of transactions.
  • The next \(N\) lines each contain three space-separated integers: \(item\_id\), \(quantity\), and \(price\).

outputFormat

Output the aggregated revenue for each unique item_id to stdout. Each line should contain two space-separated values: \(item\_id\) and the corresponding total revenue. The output must be sorted in increasing order of item_id.

## sample
1
101 2 150
101 300

</p>