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