Emptying the Glasses

Given N glasses and pairwise pour costs, find the minimum effort to end with water in at most K glasses.

Medium6Dynamic programmingGraphBit manipulationShortest pathNo attempts yetTime limit2sMemory limit32 MB

Problem

Mislav has NN glasses of unlimited volume, and every glass holds some water. He wants to drink all of the water, but he does not want to drink from more than KK glasses. The only thing he can do is pour all of the water from one glass into another glass.

The glasses are not all the same distance away from him, so the choice of glasses matters. Pouring the water from glass ii into glass jj costs CijC_{ij} effort.

Find the smallest total effort needed to leave water in at most KK glasses.

Input

The first line contains the integers NN and KK (1KN201 \le K \le N \le 20).

Each of the next NN lines contains NN integers. The jj-th number on the ii-th line is CijC_{ij} (0Cij1000000 \le C_{ij} \le 100000). Cii=0C_{ii} = 0 holds for every ii.

Output

Print the minimum total effort on one line.

Hint

If at most KK glasses hold water from the start, no pouring is needed and the answer is 0.

Water may travel through several glasses. Mislav can pour glass ii into glass jj, then later pour glass jj into glass kk.