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