#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector <double> VD;
typedef vector <VD> VVD;

VVD C;	// cost
VD prev, next;
int n, m;	// ì¿ð^¦éñ
int i, j, k;

double solve()
{
	double answer = -1.0;
	for ( i = 0; i < n; i++ ) prev[i] = 1.0;
	for ( k = 1; k < m; k++ )
	{
		for ( i = 0; i < n; i++ )
		{
			next[i] = -1.0;
			for ( j = 0; j < n; j++ )
			{
				double tmp = prev[j] * C[j][i];
				next[i] = max( next[i], tmp );
				answer = max( answer, next[i] );
			}
		}
		prev = next;
	}
	return answer;
}

int main( void )
{
	C = VVD( 100, VD( 100 ) );
	prev = VD( 100 );
	next = VD( 100 );

	while ( scanf( "%d%d", &n, &m ) != EOF && n > 0 && m > 0 )
	{
		for ( i = 0; i < n; i++ ) for ( j = 0; j < n; j++ ) scanf( "%lf", &C[i][j] );
		printf( "%.2lf\n", solve() );
	}

	return 0;
}