Computing MDSST

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

In this problem, we will consider weighted undirected graphs where all edges have positive weights.

Let D(G,i,j)D(G,i,j) be the length of the shortest path in graph GG between vertex ii and vertex jj.

We are given a complete weighted undirected graph GG which consists of nn vertices numbered from 11 to nn. Among the spanning trees of GG, the MDSST (Minimum Distance Sum Spanning Tree) is such TT for which the value S(T)=_1i<jnD(T,i,j)S(T) = \sum\_{1 \leq i < j \leq n} D(T,i,j) is minimum. Your task is to find MDSST of GG and print S(T)S(T).

입력

The first line contains an integer nn, the number of vertices in the graph (2n152 \le n \le 15). The ii-th of the following n1n-1 lines contains nin-i integers separated by spaces. The jj-th integer of this the line is the length of the edge between vertex ii and vertex i+ji+j.

All the lengths are between 11 and 10910^9, inclusive.

출력

On the first line, print one integer: the value S(T)S(T) for the MDSST you found.