#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, sum = 0;
  cin >> a >> b;
  int arr[2 * b];
  for (int i = 0; i < a; i++) {
    for (int i = 0; i < 2 * b; i++) {
      cin >> arr[i];
    }
    for (int i = 0; i < 2 * b; i += 2) {
      if (arr[i] + arr[i + 1] > 0) sum++;
    }
  }
  cout << sum;
}
