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