#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, kol = 0;
  cin >> n >> m;
  m = 2 * m;
  vector<vector<int>> v(n, vector<int>(m));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> v[i][j];
  for (int i = 0; i < n; ++i)
    for (int j = 1; j < m; j += 2)
      if (v[i][j] == 1 || v[i][j - 1] == 1) kol++;
  cout << kol;
  return 0;
}
