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