#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 123;
const long long linf = (long long)1e18 + 123;
const int inf = (int)1e9 + 123;
const double eps = 1e-6;
inline void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
long long n, m, a[311][311], cnt;
int main() {
  boost();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 2 * m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 2 * m; j += 2) {
      if (a[i][j] || a[i][j + 1]) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}
