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