#include <bits/stdc++.h>
using namespace std;
vector<int> dlin;
int a, b, c, d[1000][1000], e, n, m, cnt = 0;
string s, k, l, o;
char t, y, u;
int main() {
  cin >> a >> b;
  for (int i = 1; i <= a; i++) {
    for (int j = 1; j <= b * 2; j++) {
      cin >> d[i][j];
    }
  }
  for (int i = 1; i <= a; i++) {
    for (int j = 1; j <= b * 2; j += 2) {
      if (d[i][j] == 1 || d[i][j + 1] == 1) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}
