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