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