#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_geneous = 0; ngtkana_is_geneous < n; ngtkana_is_geneous++)
#define rep(i, begin, end) for(int i = begin; i < end; i++)
#define lint long long

#define LOCAL
using std::to_string;
auto to_string(std::string s) -> std::string {
  return '"' + s + '"';
}
auto to_string(char c) -> std::string {
  return "'" + std::string{c} + "'";
}
auto to_string(const char* s) -> std::string {
  return to_string((std::string) s);
}
auto to_string(bool b) -> std::string {
  return (b ? "true" : "false");
}
template <typename T, typename U>
auto to_string(std::pair<T, U> p) -> std::string {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <size_t N>
auto to_string(std::bitset<N> bs) -> std::string {
  std::string res{};
  for (size_t i = 0; i < N; i++)
    res.insert(res.begin(), bs.test(i) ? '1' : '0');
  return res;
}
template <typename T>
auto to_string(T v) -> std::string {
  bool flg = false;
  std::string res = "{";
  for (auto const&x : v) {
    if (flg) res += ", ";
    else flg = true;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  std::cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template <typename T>
auto make_vector(size_t sz, T t) {
  return std::vector<T>(sz, t);
}
template <size_t N, typename T, typename U, std::enable_if_t<
  N == 1, std::nullptr_t> = nullptr>
auto make_higher_vector(size_t sz, U u) {
  return make_vector(sz, T(u));
}
template <size_t N, typename T, std::enable_if_t<
  N == 1, std::nullptr_t> = nullptr>
auto make_higher_vector(size_t sz) {
  return std::vector<T>(sz);
}
template <size_t N, typename T, typename... Args, std::enable_if_t<
  N != 1, std::nullptr_t> = nullptr>
auto make_higher_vector(size_t a, Args... args) {
  return make_vector(a, make_higher_vector<N - 1, T>(args...));
}
template <typename T, typename Size_t>
auto& at(T& t, Size_t i) {
  return t.at(i);
}
template <typename T, typename Size_t, typename... Args>
auto& at(T& t, Size_t i, Args... args) {
  return at(t.at(i), args...);
}

template<typename T, typename U>
inline auto cmn (T& a, U b) {if (a > b) {a = b; return true;} return false;}
template<typename T, typename U>
inline auto cmx (T& a, U b) {if (a < b) {a = b; return true;} return false;}

lint d[501][501][501];

int main()
{
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  auto a = make_higher_vector<2, lint>(n, n);
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < n; j++)
    {
      if (i == j) continue;
      std::cin >> at(a, i, j);
    }
  }
  auto b = make_higher_vector<2, lint>(n + 1, n, -1);
  auto c = make_higher_vector<2, lint>(n, n + 1, -1);
  // auto d = make_higher_vector<3, lint>(n, n + 1, n + 1);
  for (int j = 0; j < n; j++)
  {
    at(b, 0, j) = 0;
  }
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < n; j++)
    {
      auto crr = at(b, i, j);
      at(b, i + 1, j) = crr + at(a, i, j);
    }
  }
  for (int j = 0; j < n; j++)
  {
    at(c, j, j + 1) = 0;
  }
  for (int j = 0; j < n; j++)
  {
    for (int k = j + 1; k < n; k++)
    {
      auto crr = at(c, j, k);
      at(c, j, k + 1) = crr - at(b, j, k) + at(b, k, k);
    }
  }
  for (int j = 0; j < n; j++)
  {
    for (int k = j; k <= n; k++)
    {
      // at(d, j, k, 0) = 0;
      d[j][k][0] = 0;
    }
  }
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < n; j++)
    {
      for (int k = j; k <= n; k++)
      {
        // auto crr = at(d, j, k, i);
        // at(d, j, k, i + 1) = crr - at(b, j, i) + at(b, k, i);
        d[j][k][i + 1] = d[j][k][i] - b[j][i] + b[k][i];
      }
    }
  }
  constexpr long long inf = 1LL << 60;
  auto dp = make_higher_vector<2, lint>(n, n + 1, inf);
  for (int k = 1; k <= n; k++)
  {
    at(dp, 0, k) = at(c, 0, k);
  }
  for (int i = 0; i < n; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      for (int k = j + 1; k <= n; k++)
      {
        // auto crr = at(dp, i, j);
        // if (crr == inf) continue;
        // auto val_1 = at(c, j, k);
        // auto val_2 = at(d, j, k, i);
        // cmn(at(dp, j, k), crr + val_1 + val_2);
        auto crr = dp[i][j];
        if (crr == inf) continue;
        dp[j][k] = std::min(dp[j][k], crr + c[j][k] + d[j][k][i]);
      }
    }
  }
  auto ret = inf;
  for (int i = 0; i < n; i++)
  {
    cmn(ret, at(dp, i, n));
  }
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 989184