#include <iostream>
#include <cstring>
#include <queue>
#include <cmath>
using namespace std;
const int N = 500;
typedef pair<int,int> PII;
int n, dist[N], h[N], ne[N], e[N], w[N], idx, st[N];
void add(int a, int b, int c) {
w[idx] = c, e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
int main()
{
cin >> n;
memset(h, -1, sizeof(h));
memset(dist, 0x3f, sizeof dist);
for(int i = 1; i <= n; i++) {
for(int j = i + 1; j <= n; j++) {
int c; cin >> c;
add(i, j, c);
}
}
priority_queue< PII, vector<PII>, greater<PII> > heap;
dist[1] = 0;
heap.push({0, 1});
while(heap.size()) {
auto t = heap.top(); heap.pop();
int ver = t.second, distance = t.first;
if(st[ver]) continue;
st[ver] = 1;
for(int i = h[ver]; i != -1; i = ne[i]) {
int v = e[i];
if(!st[v] && dist[v] > dist[ver] + w[i]) dist[v] = dist[ver] + w[i];
heap.push({dist[v], v});
}
}
cout << dist[n];
return 0;
}