#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

const double Eps = 1e-8;

int main()
{
	int n, m;
	while (scanf("%d %d", &n, &m), n | m)
	{
		double g[100][100];
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n; ++j)
				scanf("%lf", &g[i][j]);
		double rates[2][100];
		for (int i = 0; i < n; ++i)
			rates[0][i] = 1;

		for (int c = 1; c < m; ++c)
		{
			for (int i = 0; i < n; ++i)
			{
				rates[c & 1][i] = rates[(c+1) & 1][0] * g[0][i];
				for (int j = 1; j < n; ++j)
					rates[c & 1][i] = max(rates[c & 1][i], rates[(c+1) & 1][j] * g[j][i]);
			}
		}
		double ans = -1;
		for (int i = 0; i < n; ++i)
			ans = max(ans, rates[(m+1) & 1][i]);
		printf("%.2f\n", floor(ans*1e2+0.5+Eps)/100);
	}

	return 0;
}