One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.

Vitaly sees a building of n floors and 2·m windows on each floor. On each floor there are m flats numbered from 1 to m, and two consecutive windows correspond to each flat. If we number the windows from 1 to 2·m from left to right, then the j-th flat of the i-th floor has windows 2·j - 1 and 2·j in the corresponding row of windows (as usual, floors are enumerated from the bottom). Vitaly thinks that people in the flat aren't sleeping at that moment if at least one of the windows corresponding to this flat has lights on.

Given the information about the windows of the given house, your task is to calculate the number of flats where, according to Vitaly, people aren't sleeping.


-----Input-----

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100) — the number of floors in the house and the number of flats on each floor respectively.

Next n lines describe the floors from top to bottom and contain 2·m characters each. If the i-th window of the given floor has lights on, then the i-th character of this line is '1', otherwise it is '0'.


-----Output-----

Print a single integer — the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.


-----Examples-----
Input
2 2
0 0 0 1
1 0 1 1

Output
3

Input
1 3
1 1 0 1 0 0

Output
2



-----Note-----

In the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.

In the second test case the house has one floor and the first floor has three flats. The light is on in the leftmost flat (in both windows) and in the middle flat (in one window). In the right flat the light is off.

Difficulty: interview

Starter code:

Solutions:
n, m = [int(x) for x in input().split()]

c = 0
for _ in range(n):
    a = [int(x) for x in input().split()]
    for i in range(m):
        if a[i * 2] or a[i * 2 + 1]:
            c += 1

print(c)


n, m = list(map(int, input().split()))
ans = 0
for i in range(n):
    a = list(map(int, input().split()))
    for t in range(m):
        if a[t * 2] == 1 or a[t * 2 + 1] == 1:
            ans += 1
print(ans)


#!/usr/bin/env python3

try:
    while True:
        n, m = list(map(int, input().split()))
        result = 0
        for i in range(n):
            a = list(map(int, input().split()))
            for j in range(m):
                if a[j << 1] or a[j << 1 | 0x1]:
                    result += 1
        print(result)
except EOFError:
    pass


n, m = [int(s) for s in input().split()]
c = 0
for j in range(n):
    s = input().split()
    for i in range(0, 2*m, 2):
        if s[i] == '1' or s[i+1] == '1':
            c+=1
print(c)


n, m = map(int, input().split())
arr = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in arr:
    for k in range (m):
        if (i[2 * k + 1] == 1 or i[2 * k] == 1):
            ans += 1
print(ans)

import math
from decimal import *
import sys
from fractions import Fraction

inp=input().split()
n=int(inp[0])
m=int(inp[1])
ans=0
for i in range(0,n):
    row = list(map(int,input().split()))
    for j in range(0,m):
        if row[2*j] == 1 or row[2*j+1] == 1:
            ans+=1
print(ans)

    
    


N, M = map(int, input().split())
Sum = 0
for i in range(N):
    a = list(map(int, input().split()))
    for j in range(M):
        if a[2*j] or a[2*j + 1]:
            Sum += 1
print(Sum)

# import sys
# n = int(input())
# s = input().strip()
# a = [int(tmp) for tmp in input().split()]
# for i in range(n):
n, m = [int(tmp) for tmp in input().split()]
ans = 0
for i in range(n):
    lvl = [int(tmp) for tmp in input().split()]
    for j in range(m):
        if lvl[2 * j] == 1 or lvl[2 * j + 1] == 1:
            ans += 1
print(ans)

import sys


#sys.stdin = open("input.txt")
#sys.stdout = open("output.txt", "w")

n, m = (int(i) for i in input().split())
ans = 0
for i in range(n):
	lst = [int(j) for j in input().split()]
	for j in range(m):
		if lst[2*j] == 1 or lst[2*j + 1] == 1:
			ans += 1
print(ans)	

n,m = list(map(int, input().split()))
ans = 0;
for i in range(n):
	ints = list(map(int, input().split()))
	for j in range(m):
		if any(ints[2*j: 2*j+2]):
			ans += 1
print (ans)


n, m = list(map(int, input().split()))
cnt = 0
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(0, 2 * m, 2):
        cnt += a[j] or a[j + 1]
print(cnt)


n, m = list(map(int, input().split()))
sum1 = 0
for i in range(n):
    ar = list(map(int, input().split()))
    for j in range(len(ar) - 1):
        if (j % 2 == 0):
            if (ar[j] or ar[j + 1]):
                sum1 += 1
print(sum1)


n, m = map(int, input().split())
ans = 0
for i in range(n):
    row = list(map(int, input().split()))
    for j in range(0, 2 * m, 2):
        if row[j] + row[j + 1] > 0:
            ans += 1

print(ans)

read = lambda: list(map(int, input().split()))
n, m = read()
a = [list(read()) for i in range(n)]
cnt = 0
for i in range(n):
    for j in range(m):
        if a[i][2 * j + 1] == 1 or a[i][2 * j] == 1:
            cnt += 1
print(cnt)


__author__ = 'cmashinho'

n, m = map(int, input().split())
ans = 0

for _ in range(n):
    l = list(map(int, input().split()))
    for i in range(1, len(l), 2):
        if l[i] == 1 or l[i - 1] == 1:
            ans += 1

print(ans)

n, m = map(int, input().split())
arr = [0] * n
cnt = 0
for i in range(n):
    arr[i] = [int(x) for x in input().split()]

for i in range(n):
    for j in range(0, 2 * m, 2):
        try:
            if arr[i][j] == 1 or arr[i][j+1] == 1:
                cnt += 1
        except:
            pass

print(cnt)

def __starting_point():
    n, m = map(int, input().split())

    total = 0
    for x in range(n):
        data = list(map(int, input().split()))
        total += sum(map(lambda x: min(1, x[0] + x[1]), zip(data[0::2], data[1::2])))

    print(total)
__starting_point()

n,m = list(map(int,input().split()))
L = [list(map(int, input().split())) for _ in range(n)]
r = 0
for k in range(n):
    for i in range(m):
        if L[k][2*i+1] or L[k][2*i]:
            r+=1
print(r)



n, m = list(map(int, input().split()))
c = 0
for i in range(n):
    appts = list(map(int, input().split()))
    for j in range(m):
        x = appts[2*j]
        y = appts[2*j + 1]
        c += (1 if (x > 0 or y > 0) else 0)

print(c)


n,m=map(int,input().split())
a=[0]*n
k=0
for i in range(n):
    a[i]=list(map(int,input().split()))
for i in range(n):
    for j in range(0,2*m,2):
        if a[i][j]==1 or a[i][j+1]==1:
            k+=1
print(k)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

n,m = list(map(int,input().split()))
ans = 0
for i in range(n):
    flats = list(map(int,input().split()))
    f = [False for i in range(m)]
    for j in range(m*2):
        f[j//2] |= True if flats[j] == 1 else False
    ans += f.count(True)
print(ans)


n, m = list(map(int, input().split()))
sum = 0
for k in range(n):
    tmp = list(map(int, input().split()))
    i = 0
    for j in range(m):
        if tmp[i] or tmp[i + 1]:
            sum += 1
        i += 2
print(sum)


n, m = map(int, input().split())
arr = [list(map(int, input().split())) for i in range(n)]
h = [[False for j in range(m)] for i in range(n)]
cnt = 0
for i in range(n):
    for j in range(m):
        h[i][j] = arr[i][j*2] or arr[i][j*2+1]
        if h[i][j]:
            cnt += 1
print(cnt)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import time

#   = input()
#   = int(input())

#() = (i for i in input().split())
#   = [i for i in input().split()]

(n, m) = (int(i) for i in input().split())
app    = []
for i in range(n):

    app.append([ 0 for j in range(m) ])
    a = [int(j) for j in input().split()]

    for j in range(len(a)):
        app[i][divmod(j, 2)[0]] += a[j]

start = time.time()

#print(app)
s = 0
for i in range(n):
    s += sum([1 for j in app[i] if j>0])

print(s)
finish = time.time()
#print(finish - start)


n,m = list(map(int,input().split()))

total = 0

for i in range(n):
    arr = list(map(int,input().split()))
    j = 0
    while j < 2 * m:
        total += arr[j] or arr[j + 1]
        j += 2

print(total)