#include <bits/stdc++.h>
using namespace std;
int a[200][200];
int main() {
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < h; ++i)
    for (int j = 0; j < w; ++j) cin >> a[i][j];
  int ans = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < w; ++j) ans += a[i][j];
  cout << ans << endl;
  return 0;
}
