#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int maxN = 500005;
int main() {
  int n, m, a, b, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a >> b;
      if (a + b >= 1) sum++;
    }
  }
  cout << sum;
}
