Problem K. Kolya writes a feature

Author:twitch.tv/jollyfuzz   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

Kolya’s team switched to a new tool for automating continuous integration and continuous delivery processes - GitClub CI/CD.

Pipeline consists of N stages, and stages consist of Mi jobs.

All jobs in one stage are executed in parallel, and the next stage cannot begin until all jobs in the previous stage have completed.

Kolya needs to write a feature that, based on a given description of stages and durations of tasks, calculates total execution time of the pipeline.

Input format

First line contains one integer N - number of stages.

Next lines are descriptions of N stages, the description of each stage consists of three lines:

First line - string from small Latin letters and underscores Xi - name of the stage.

Second line - integer Mi - number of tasks in the stage.

Third line - integer array Ti - tasks durations in seconds.

Output format

One integer - total execution time of pipeline in seconds.

Constraints

1 ≤ N ≤ 100

1 ≤ |Xi| ≤ 100

1 ≤ Mi ≤ 1000

1 ≤ Ti,j ≤ 107

Sample tests

No. Standard input Standard output
1
3
build_stage
3
5 7 1
test_stage
5
1 6 8 9 2
deploy_stage
2
2 2
18

0.069s 0.007s 13