#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<iomanip>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 110
#define M 110
double dp[M][N];
double g[M][M];
int n,m;

double shishagonyu2(double x){
  ll a=x*1000;
  a=a/10+(a%10>=5?1:0);
  x=(double)a/100.0;
  return x;
}

int main(){
  //cout<<shishagonyu2(5.5555)<<endl;
  while(cin>>n>>m&&n+m){
    lol(i,n)lol(j,n)cin>>g[i][j];
    lol(i,n)dp[0][i]=1.0;
    lol(i,m)lol(j,n)dp[i+1][j]=0.0;
    lol(i,m){
      lol(j,n){
	lol(k,n){
	  dp[i+1][k]=max(dp[i+1][k],dp[i][j]*g[j][k]);
	}
      }
    }
    double ans=0;
    lol(i,n)ans=max(ans,dp[m-1][i]);
    ans=shishagonyu2(ans);
    cout<<fixed<<setprecision(2)<<ans<<endl;
  }
  return 0;
}