#K94832. Calculate Total Daily Feed

    ID: 38729 Type: Default 1000ms 256MiB

Calculate Total Daily Feed

Calculate Total Daily Feed

You are given information about several animals in a shelter. Each animal has a species name, an age, and a list of feeding requirements. Each feeding requirement consists of a food type and the quantity of that food required per day.

Your task is to compute the total quantity required for each food type, summed over all animals. Formally, if an animal has a feeding requirement of a food type \(f\) with quantity \(q\), then the total quantity \(T_f\) for that food over all animals is given by:

[ T_f = \sum_{i=1}^{n} q_{i,f} ]

where \(n\) is the number of animals, and \(q_{i,f}\) is the quantity for food \(f\) for the \(i\)-th animal (if any).

Note: The output should list the food types in lexicographical order, each on a separate line in the format FoodType: Quantity.

inputFormat

The first line contains an integer \(N\) representing the number of animals.

Then, for each animal, the input is given in the following format:

  • A line containing the species (a string, which may contain spaces).
  • A line containing two integers: the age of the animal and \(M\), the number of feeding requirements.
  • For each of the \(M\) feeding requirements:
    • A line containing the food type (a string, which may contain spaces).
    • A line containing an integer representing the quantity required.

You can assume that the input is valid.

outputFormat

Output the total quantity required for each food type. For each food type, print a line in the format:

FoodType: Quantity

The food types must be printed in lexicographical order.

## sample
3
Dog
5 2
Dry Food
2
Water
1
Cat
3 2
Dry Food
1
Water
1
Parrot
2 2
Seeds
3
Water
1
Dry Food: 3

Seeds: 3 Water: 3

</p>