#include <bits/stdc++.h>
int main() {
  int m, n;
  scanf("%d %d", &n, &m);
  int count = 0, j, i;
  for (i = 0; i < n; i++) {
    for (j = 0; j < 2 * m; j += 2) {
      int flat1, flat2;
      scanf("%d %d", &flat1, &flat2);
      if (flat1 == 1 || flat2 == 1) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
