#C490. Sum of Minimum Values

    ID: 48489 Type: Default 1000ms 256MiB

Sum of Minimum Values

Sum of Minimum Values

Given a two-dimensional array of integers, your task is to compute the sum of the minimum values from each row. Each row may contain a different number of elements.

The input consists of multiple lines. The first line contains a single integer \(r\) indicating the number of rows. Each of the following \(r\) lines contains space-separated integers representing one row of the array.

You need to find the minimum value in each row and then output the sum of these minimum values.

inputFormat

The first line of the input contains a positive integer \(r\) (the number of rows). Each of the next \(r\) lines contains at least one integer, with the integers in a row separated by spaces.

outputFormat

Output a single integer: the sum of the minimum elements from each row.

## sample
3
1 2 3
4 5 6
7 8 9
12