#C8045. Total Inventory Value

    ID: 51984 Type: Default 1000ms 256MiB

Total Inventory Value

Total Inventory Value

You are given an inventory of items. Each item has a name, a price (a floating point number), and a quantity (an integer). Your task is to calculate the total inventory value.

The total value is computed using the following formula:

$$ V = \sum_{i=1}^{n} (price_i \times quantity_i) $$

If no items are provided, the result is 0.0.

inputFormat

The first line contains an integer n (\( n \geq 0 \)), which represents the number of items in the inventory. Each of the following n lines describes an item with three values separated by spaces:

  • name: a string without spaces, representing the name of the item.
  • price: a floating point number.
  • quantity: an integer.

For example:

3
apple 1.0 10
banana 0.5 20
orange 0.25 40

outputFormat

Output the total value of the inventory as a floating point number. The output should be printed to stdout.

For instance, for the example above the output should be:

30.0
## sample
0
0.0