#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, kil;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> a >> b;
      if (a + b > 0) kil++;
    }
  cout << kil << endl;
  return 0;
}
