#include <bits/stdc++.h>
int main() {
  int n, m, i;
  scanf("%d %d", &n, &m);
  int awake = 0;
  for (i = 0; i < n; i++) {
    int j = 0;
    for (; j < m; j++) {
      int a, b;
      scanf("%d %d", &a, &b);
      if (a + b > 0) awake++;
    }
  }
  printf("%d", awake);
  return 0;
}
