#C9587. Minimum Hours to Complete Tasks

    ID: 53696 Type: Default 1000ms 256MiB

Minimum Hours to Complete Tasks

Minimum Hours to Complete Tasks

Alice is working on several projects, and each project consists of a set of tasks. For each project, you are given a list of integers where the first integer \(k\) indicates the number of tasks in that project and the following \(k\) integers represent the hours required to complete each task. Your task is to determine the total number of hours Alice will need to work for each test case.

The formula to compute the total hours for a single test case is:

\( Total\ Hours = \sum_{i=1}^{P} \sum_{j=1}^{k_i} a_{ij} \)

where \(P\) is the number of projects and \(a_{ij}\) is the number of hours for the \(j^{th}\) task in the \(i^{th}\) project.

inputFormat

The input begins with an integer indicating the number of test cases contained in the file. For each test case, the input is structured as follows:

  • The first line contains a single integer \(P\), representing the number of projects.
  • Each of the following \(P\) lines starts with an integer \(k\) (the number of tasks in that project), followed by \(k\) space-separated positive integers representing the hours required for each task.

Note: Each test file given to your program will contain exactly one test case (the first integer in the file will be 1), even though the overall competition has multiple such files.

outputFormat

For each test case, output a single line with the total number of hours required to complete all tasks across all projects.

## sample
1
1
3 2 4 6
12

</p>