import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
T Read(T)() { return readln.chomp.to!(T); }
T[] Reads(T)() { return readln.split.to!(T[]); }
alias read = Read!(int);
alias reads = Reads!(int);

int[][] c;

void main() {
    int n = read();
    foreach (i;0..n) c ~= reads();
    long s;
    foreach (i; 0..n) foreach (j; 0..n)
        if (i < j) s += min(c[i][j], c[j][i]);
    writeln(s);
}
