#K9966. Sum of Grid Tiles
Sum of Grid Tiles
Sum of Grid Tiles
You are given a grid of tiles with n rows and m columns. Each tile contains an integer value. Your task is to compute the sum of all the numbers in the grid.
The grid is provided as a series of lines, where the first line contains two integers \(n\) and \(m\) representing the number of rows and columns respectively. Each of the subsequent \(n\) lines contains \(m\) integers separated by spaces, representing the values of the tiles in that row.
Your solution should read the input from stdin
and output the result to stdout
.
inputFormat
The input begins with a line containing two integers \(n\) and \(m\) (\(1 \leq n, m \leq 1000\)), followed by \(n\) lines. Each of these lines contains \(m\) integers separated by spaces representing the grid values.
outputFormat
Output a single integer: the sum of all the grid's tile values.
## sample2 3
1 2 3
4 5 6
21