#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long n;
  int a[201], m, k = 0;
  cin >> n >> m;
  while (n) {
    for (int i = 1; i <= 2 * m; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) {
      if (a[2 * i - 1] == 1 || a[2 * i] == 1) k++;
    }
    n--;
  }
  cout << k;
}
