#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j;
  while (scanf("%d %d", &i, &j) == 2, i && j) {
    map<int, vector<int> > table;
    for (int x = 0; x < i; ++x) {
      for (int y = 0; y < j; ++y) {
        int w;
        scanf("%d", &w);
        table[x].push_back(w);
      }
    }
    for (int x = 0; x < j; ++x) {
      for (int y = x + 1; y < j; ++y) {
        int w;
        scanf("%d", &w);
        table[x + i].push_back(w);
      }
    }
    int mat[j];
    for (int x = 0; x < j; ++x) mat[x] = 1000;
    for (int x = 0; x < i; ++x) {
      for (int y = 0; y < table[x].size(); ++y) {
        if (table[x][y] != 0 && mat[y] > table[x][y]) {
          mat[y] = table[x][y];
        }
      }
    }
    for (int x = 0; x < j - 1; ++x) {
      for (int y = 0; y < table[x + i].size(); ++y) {
        if (table[x + i][y] != 0 && mat[y + x + 1] > table[x + i][y]) {
          mat[y + x + 1] = table[x + i][y];
        }
      }
    }
    int aux = 0;
    for (int x = 0; x < j; ++x) aux += mat[x];
    cout << aux << endl;
  }
  return 0;
}
