#C5925. Total Expenditure Calculation

    ID: 49628 Type: Default 1000ms 256MiB

Total Expenditure Calculation

Total Expenditure Calculation

You are given information about several customers and their orders. Each customer may have several orders, and each order contains several items. For each item, you are given an item identifier, its price and the quantity ordered. Your task is to calculate the total expenditure for each customer by summing up the products of price and quantity of all items across all orders.

Details:

  • The first line of input contains an integer n which represents the number of customers.
  • For each customer, the first line contains an integer representing the number of orders.
  • For each order, the first line contains an integer representing the number of items in that order, followed by that many lines each containing three integers: item_id, price, and quantity.
  • Output a line for each customer in the format: Customer i: total_amount where i is the customer number (1-indexed) and total_amount is the total expenditure for that customer, computed as \(\sum (price \times quantity)\) over all items in all orders.

All mathematical expressions are to be formatted in LaTeX. For example, the formula for total expenditure is given as:

\(Total = \sum_{order} \sum_{item} (price \times quantity)\)

inputFormat

The input consists of multiple lines:

  • The first line contains an integer \(n\), the number of customers.
  • For each customer, the first line contains an integer representing the number of orders.
  • For each order, the first line contains an integer representing the number of items, followed by that many lines each containing three space-separated integers \(item\_id\), \(price\), and \(quantity\).

outputFormat

For each customer, output a single line in the format:

Customer i: total_amount

where i is the customer number (starting from 1) and total_amount is computed as \(\sum (price \times quantity)\) for all items in all orders of that customer.

## sample
1
1
2
101 50 2
102 70 1
Customer 1: 170

</p>