#include <bits/stdc++.h>
using namespace std;
const int mx = 1e6 + 11;
const double PI = acos(-1);
void faltu() { cerr << endl; }
template <typename T, typename... hello>
void faltu(T arg, const hello &...rest) {
  cerr << arg << ' ';
  faltu(rest...);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m, cnt = 0;
  cin >> n >> m;
  int a[n][2 * m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2 * m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2 * m; j += 2) {
      if (a[i][j] == 1 || a[i][j + 1] == 1) cnt++;
    }
  }
  cout << cnt << '\n';
  return 0;
}
