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