#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> m >> n;
  int t[m][2 * n];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < 2 * n; j++) cin >> t[i][j];
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < 2 * n; j += 2) {
      if (t[i][j] == 1 || t[i][j + 1] == 1) cnt++;
    }
  }
  cout << cnt << endl;
}
