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