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