Stefan, an artificial intelligence enthusiast, has undertaken his greatest challenge yet: to create an AI that can solve any problem in competitive programming.
After many years of research, Stefan has finally created you, a prototype AI, to carry out this task. Now, Stefan would like you to demonstrate your capabilities to him, starting with a simple problem.
You are given an by grid with rows numbered to and columns numbered to . Your task is to find the sum of all even numbers in even rows or even columns in the grid.
Please solve the problem correctly to avoid disappointing your creator.
Input Specification
The first line will contain two space-separated integers, and .
The next lines will each contain space-separated integers, describing the grid. The th integer in the th line will contain the element .
Output Specification
Output one integer, the sum of all even numbers in even rows or even columns in the grid.
Sample Input
4 3
1 2 3
5 1 2
10 2 4
1 6 5
Sample Output
12
Sample Explanation
Above is a representation of the grid for this sample case. We must consider any even integer in row , row , or column . The answer will be .
Comments