#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int c = 0;     int a[2 * m];     for (int i = 0; i < n; i++) {       for (int j = 0; j < 2 * m; j++) cin >> a[j];       for (int j = 0; j < 2 * m - 1; j += 2) {         if (a[j] == 1 || a[j + 1] == 1) c++;       }     }     cout << c << endl;   }   