#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
int n, m, a[N][2 * N];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 2 * m; ++j) {
      cin >> a[i][j];
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 2 * m; j += 2) {
      if (a[i][j] or a[i][j + 1]) cnt += 1;
    }
  }
  cout << cnt << endl;
  return 0;
}
