#include<cstdio>
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n,m;
	while(scanf("%d%d",&n,&m),n){
		double g[n][n],c[n][m],ans=0;
		rep(i,n){
			rep(j,n)scanf("%lf",g[i]+j);
			rep(j,m)c[i][j]=j?0:1;
		}
		rep(i,m-1)rep(j,n)rep(k,n)if(c[k][i+1]<c[j][i]*g[j][k])
		c[k][i+1]=c[j][i]*g[j][k];
		rep(i,n)if(c[i][m-1]>ans)ans=c[i][m-1];
		printf("%.2f\n",ans);
	}
	return 0;
}