#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int floor[n][2 * m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2 * m; j++) {
      cin >> floor[i][j];
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2 * m - 1; j += 2) {
      if (floor[i][j] == 1 || floor[i][j + 1] == 1) {
        count++;
      }
    }
  }
  cout << count << "\n";
}
