#K85157. Calculate Total Borrowed Books
Calculate Total Borrowed Books
Calculate Total Borrowed Books
Given several groups of book borrowing records, your task is to calculate the total number of books borrowed in each group. For each group, if there are (N) books with borrowing counts (c_1, c_2, \ldots, c_N), then the total borrow count is given by (S = \sum_{i=1}^{N} c_i). Note that the book title may contain spaces and the borrow count is always the last token in its line.
Compute the total borrow counts and output each result on a separate line.
inputFormat
The input is read from stdin. The first line contains an integer (G) representing the number of groups. For each group, the first line contains an integer (N) denoting the number of books in the group. The following (N) lines each contain a book title (which may include spaces) followed by a space and an integer representing the borrow count.
outputFormat
Output to stdout (G) lines. Each line should contain a single integer representing the total borrowed count for that group.## sample
2
3
The Hobbit 5
The Silmarillion 3
Unfinished Tales 1
2
1984 12
Animal Farm 7
9
19
</p>