#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> v(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int a, b;
      cin >> a >> b;
      cnt += a || b;
    }
  }
  cout << cnt;
  return 0;
}
