#include <bits/stdc++.h>
using namespace std;
int n, m;
bool ok;
int main(void) {
  cin >> n >> m;
  int ans = 0;
  bool a, b;
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < m; i++) {
      cin >> a >> b;
      ok = a || b;
      if (ok) ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}
