#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;

#define EPS pow(10, -9)

int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0) {
			break;
		}
		vector< vector<long double> > hyou(n, vector<long double>(n));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> hyou[i][j];
			}
		}
		vector< vector<long double> > nae(m, vector<long double>(n, 1.0));
		for (int i = 1; i < m; i++) {
			for (int j = 0; j < n; j++) {
				nae[i][j] = nae[i-1][0]*hyou[0][j];
				for (int k = 1; k < n; k++) {
					nae[i][j] = max(nae[i][j], nae[i-1][k]*hyou[k][j]);
				}
			}
		}
		long double MAX = 0.0;
		for (int i = 0; i < n; i++) {
			MAX = max(MAX, nae[m-1][i]);
		}
		MAX += EPS;
		MAX *= 100.0;
		if (MAX-(long double)((int)MAX) >= 0.5) {
			MAX += 1.0;
		} 
		MAX /= 100.0;
		printf("%.2Lf\n", MAX);
	}
	return 0;
}