By Cristhian Bonilha, UTFPR Brazil
Most of the programmers who come to write contests with programming exercises agree in four caracteristics that every contest should achieve. Although not all of them are always achieved, more is better. The caracterists are the following:
Rafael organized a contest a few days ago, and is worried about how many of these caracteristics he got to achieve with his contest.
Given the information about the contest, with the number of contestants, the number of problems, and which contestant solved which problem, find out the number of caracteristics that were achieved on this contest.
There will be several tests cases. Each test case starts with two integers N and M (3 ≤ N, M ≤ 100).
Then, there will be N lines with M integers each, where the integer on the i-th line and on the j-th column is 1 if the i-th contestant solved the j-th problem, or 0 otherwise.
The last test case is indicated when N = M = 0, which should not be processed.
For each test case, print one line with one integer, representing the amount of caracteristics achieved by the given contest.
Sample Input | Sample Output |
3 3 |
2 |