Magic Potion

Given a complete graph with edge weights and K potions that halve one trip's time, find the shortest time from city 0 to city 1.

Medium5Shortest pathGraphDynamic programmingNo attempts yetTime limit2sMemory limit512 MB

Problem

There are NN cities numbered 0 to N1N-1. Every pair of cities is directly connected, so travel between any two cities is always possible.

You are given the travel time between every pair of cities and the number of magic potions KK that you hold. Drinking a magic potion lets you move twice as fast as usual. When you travel from one city to another you may use one magic potion, and that trip then takes half its usual time. You cannot spend two or more potions on a single trip, and you do not have to drink every potion you hold.

Find the shortest time to get from city 0 to city 1.

Input

The first line contains the number of cities NN and the number of magic potions KK. (2N502 \le N \le 50, 0K500 \le K \le 50)

The next NN lines contain the travel time matrix. Each line is NN digits written with no separators. The value in row ii, column jj is the time to travel from city ii to city jj, and rows and columns are both counted from 0. Each time is an integer between 0 and 9.

For all ii and jj, the value in row ii, column jj equals the value in row jj, column ii, and the value in row ii, column ii is always 0.

Output

Print the shortest time from city 0 to city 1 with exactly one digit after the decimal point. The answer is always a multiple of 0.5, so one decimal digit represents it exactly.