#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[400], i, j, count = 0;
  cin >> n >> m;
  while (n--) {
    for (i = 1; i <= 2 * m; i++) cin >> a[i];
    for (i = 1; i < 2 * m;) {
      if (a[i] == 1 or a[i + 1] == 1) count++;
      i += 2;
    }
  }
  cout << count << endl;
  return 0;
}
