#C6883. Total Harvest Time Calculation

    ID: 50692 Type: Default 1000ms 256MiB

Total Harvest Time Calculation

Total Harvest Time Calculation

You are given a two-dimensional grid of integers, where each cell represents the harvest time for a crop. A cell with a value of 0 indicates that there is no crop planted. Your task is to calculate the total harvest time by summing the harvest times of all crops (i.e. positive integers) in the grid.

The grid is given in the following format:

  • The first line contains two integers \(m\) and \(n\), which represent the number of rows and columns, respectively.
  • Each of the next \(m\) lines contains \(n\) space-separated integers representing the values in the grid.

Output a single integer, which is the total harvest time calculated by summing up all positive integers in the grid.

inputFormat

The input is given via standard input and consists of:

  • One line with two integers \(m\) and \(n\): the number of rows and columns.
  • \(m\) subsequent lines, each containing \(n\) space-separated integers representing the grid.

outputFormat

Output via standard output a single integer representing the total harvest time, which is the sum of all positive integers in the given grid.

## sample
3 3
3 0 2
0 4 0
1 0 5
15