1.3 Mario VS The Goombas
(RankList for this Question)
Score: 60pts
Time Limit: 2.00 sec
There are m floors in a Mario game with each floor represented as 0s being the walkable indexes, and 1s being the goombas. To avoid the goombas, he can jump one unit over them. But while landing, if Mario lands on another goomba, he bounces up onto the floor above him at the next index. If there is no floor above him, Mario lands on the lowest floor.

Starting from the leftmost index and floor 0, find out which floor Mario ends up on after reaching the rightmost index.

Constraints
1 <= M,N <= 50

Input Format
m n
floor0
floor1
..
floor(m-1)

m and n are the numbers of floors and length of all floors respectively where n is always greater than 1.
2nd line onwards is a series of 1s and 0s separated by space, each line representing a floor starting from floor 0. Starting index of floor 0 and ending indexes of all floors will be 0s

Output Format
Just one line containing only the Floor number.

Example 1
Input:
3 7
0 0 1 1 1 1 0
1 0 1 1 1 0 0
1 1 0 0 1 1 0

Output:
0

Explanation:
Starting from floor 0, Mario starts at index 0. Goes to 1.
Now, to avoid the goomba at index 2, he jumps over, but since he lands on goomba at index 3, he bounces to the next floor (1st floor) and lands at index 4.
Since, there is another goomba at index 4, he bounces again on the goomba and goes to 2nd floor, and lands at index 5. Similarly, landing at floor 0 at index 6.
Mario reaches the last index of floor 0.