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