#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define PREP(it,array) for(vector<P>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)

#define MP       make_pair
#define PB       push_back
#define ALL(x)   (x).begin(),(x).end()

const int INF = 1<<29;
const double EPS = 1e-9;
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef long long LL;
typedef pair<int,int> P;


int n,m;
double g[100+1][100+1];
double memo[100+1][100+1];

double solve( int day, int prev ){
  if( day == m+1 )
    return 1.0;

  if( memo[day][prev] != 0.0 )
    return memo[day][prev];

  double res = 1.0;
  for(int i=1; i<=n; i++){
    res = max( res, solve(day+1, i) * g[prev][i] );
  }

  memo[day][prev] = res;
  return res;
}


int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(2);

  while( cin>>n>>m, n ){
    memset( memo, 0, sizeof(memo) );

    REP(i,n+1){
      REP(j,n+1)
	g[i][j] = 1.0;
    }
    REP(i,n){
      REP(j,n){
	double t;
	cin >> t;
	g[i+1][j+1] = t;
      }
    }

    double res = solve( 1, 0 );
    res *= 100;
    res += 0.5;
    res = int(res);
    res /= 100;

    cout << res << endl;
  }


  return 0;
}