#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ld = long double;
using ulli = unsigned long long int;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  int counter = 0;
  int count = 0;
  int arent_sleeping = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= m * 2; j++) {
      int x;
      cin >> x;
      if (x == 1) {
        count += 1;
      }
      counter += 1;
      if (counter == 2) {
        counter = 0;
        if (count > 0) {
          arent_sleeping += 1;
        }
        count = 0;
      }
    }
  }
  cout << arent_sleeping;
}
