#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <math.h>
#include <string>
using namespace std;
int n, m;
int temp[105][205];
int ans;
int main() {
scanf("%d %d", &n, &m);
for (int i = 1;i <= n;++i) {
for (int j = 1;j <= 2 * m;j += 2) {
scanf("%d %d", &temp[i][j], &temp[i][j + 1]);
if (temp[i][j] == 1 || temp[i][j + 1] == 1) {
ans++;
}
}
}
printf("%d\n", ans);
//system("pause");
return 0;
}