#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, z = 0;
int main() {
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> x >> y;
      if (x || y) z++;
    }
  }
  cout << z;
  return 0;
}
