#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0;
  int window1, window2;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> window1 >> window2;
      if (window1 + window2 >= 1) ans++;
    }
  cout << ans;
}
