#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
using namespace std;
void CINT() {}
template <class Head, class... Tail>
void CINT(Head&& head, Tail&&... tail) {
  cin >> head;
  CINT(move(tail)...);
}
int main() {
  int h, w;
  CINT(h, w);
  vector<vector<int> > a(h, vector<int>(w));
  for (auto&(aa) : (a))
    for (auto& youso_ : (aa)) cin >> youso_;
  cout << (accumulate((a[0]).begin(), (a[0]).end(), 0) +
           accumulate((a[1]).begin(), (a[1]).end(), 0))
       << endl;
  return 0;
}
