The first line contains the number of cities N and the number of magic potions K. (2≤N≤50, 0≤K≤50)
The next N lines contain the travel time matrix. Each line is N digits written with no separators. The value in row i, column j is the time to travel from city i to city j, and rows and columns are both counted from 0. Each time is an integer between 0 and 9.
For all i and j, the value in row i, column j equals the value in row j, column i, and the value in row i, column i is always 0.