#C1665. Total Mana Calculation

    ID: 44895 Type: Default 1000ms 256MiB

Total Mana Calculation

Total Mana Calculation

In this problem, you are given multiple test cases. Each test case contains a group of wizards, and for each wizard you are given the mana cost of the spells they have memorized. Your task is to compute the total mana for each wizard by summing the mana costs of their spells.

For a wizard with spells having mana costs (a_1, a_2, \dots, a_k), the total mana required is given by

i=1kai\sum_{i=1}^{k} a_i

If a wizard has no spells (i.e. (k = 0)), the total mana is 0.

Your program should read input from standard input (stdin) and write the results to standard output (stdout). Each test case's answer should be printed on a separate line, with the total mana for each wizard separated by a single space.

inputFormat

The first line of input contains an integer (T), representing the number of test cases.

For each test case:

  • The first line contains an integer (N), the number of wizards.
  • Each of the next (N) lines begins with an integer (m), the number of spells for that wizard, followed by (m) integers denoting the mana cost of each spell.

outputFormat

For each test case, output a single line containing (N) integers. The (i)-th integer should be the total mana required by the (i)-th wizard. The results for different test cases should appear on separate lines in the same order as the input test cases.## sample

1
3
2 10 20
5 5 5 5 5
3 15 3 8
30 25 26

</p>