#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, x, y, ans;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= 2 * m; j += 2) {
      cin >> x >> y;
      if (x + y > 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
