#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int n, m; double e[111][111], dp[111][111];
int main() {
	while (cin >> n >> m) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) cin >> e[i][j];
		}
		for (int i = 0; i < n; i++) dp[0][i] = 1.0;
		for (int i = 1; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = 0.0;
				for (int k = 0; k < n; k++) {
					dp[i][j] = max(dp[i][j], dp[i - 1][k] * e[k][j]);
				}
			}
		}
		cout << fixed << setprecision(2) << *max_element(dp[m - 1], dp[m - 1] + n) << endl;
	}
	return 0;
}