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