#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n, m;
  cin >> n >> m;
  char a[2 * n * m];
  for (i = 0; i < 2 * n * m; i++) scanf(" %c", &a[i]);
  int sum = 0, count = 0;
  for (i = 0; i < 2 * n * m; i += 2) {
    sum = 0;
    for (j = i; j <= i + 1; j++) {
      sum += (a[j] - 48);
    }
    if (sum >= 1) count++;
  }
  cout << count << endl;
  return 0;
}
