#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  cin >> n >> m;
  long long ans = (unsigned long long)(-1) / 2;
  vector<vector<long long> > v(m, vector<long long>(n)),
      h(m - 1, vector<long long>(n));
  for (int i = 0; i < m - 1; i++)
    for (int j = 0; j < n; j++) cin >> h[i][j];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> v[i][j];
  for (int c = 0; c < m - 1; c++) {
    for (int i = (1 << n) - 1; i >= 0 && (c != 0 || i == (1 << n) - 1); i--) {
      vector<bool> b(n, false);
      long long ex = i;
      while (ex) {
        b[__builtin_ctz(ex)] = true;
        ex -= ex & (-ex);
      }
      ex = 0;
      for (int r = 0; r < n; r++)
        if (b[r]) {
          ex += h[c][r];
          if (!b[((r + 1) % n)]) ex += v[c][r];
          if (!b[((r - 1 + n) % n)]) ex += v[c][((r - 1 + n) % n)];
        } else
          ex += h[c - 1][r];
      ans = min(ans, ex);
    }
  }
  cout << ans << endl;
}
