//パソコン甲子園2008本選 問題09

#include<stdio.h>

int main(void){

	double *nl, **L, *ml, max, tmp;
	int n, m, f1, f2, f3;
	
	while(scanf("%d %d",&n,&m) && n > 0){
	
		L = new double *[n];
		nl = new double [n];
		 
		for(f1 = 0; f1 < n; f1++){
			nl[f1] = 1.0;//１回目は1.0なので1.0で初期化
			L[f1] = new double [n];
			for(f2 = 0; f2 < n; f2++)
				scanf("%lf",&L[f1][f2]);
		}
		
		for(f1 = 1; f1 < m; f1++){
		
			ml = new double [n];
			
			for(f2 = 0; f2 < n; f2++)//初期化
				ml[f2] = 0.0;
			//計算
			for(f2 = 0; f2 < n; f2++){
				for(f3 = 0; f3 < n; f3++){
					tmp = nl[f2] * L[f2][f3];
					if(tmp > ml[f3])
						ml[f3] = tmp;
				}
			}
			nl = ml;
		}
		//最大値を求める
		max = nl[0];
		for(f1 = 0; f1 < n; f1++){
			if(max < nl[f1])
				max = nl[f1];
		}
		//出力
		printf("%.2lf\n",max);
			
	}
	return 0;
}