#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m * 2; j += 2) {
      int a1, a2;
      cin >> a1 >> a2;
      if (a1 || a2) ans++;
    }
  }
  cout << ans << '\n';
}
