
import scala.annotation.tailrec
import scala.collection.{immutable, mutable}
import scala.io.StdIn._
object Main extends App {

  loop()
  @tailrec def loop(): Unit = {
    val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
    if (n == 0 && m == 0) return
    val map = Array.fill(n){readLine.trim.split(' ').map(_.toDouble)}
    val maxHeight = Array.fill(2){Array.fill(n){1d}}
    for (i ← 1 until m){
      for (j ← 0 until n){
        maxHeight(i % 2)(j) = 0d
      }
      for (g ← 0 until n; p ← 0 until n){
        maxHeight(i % 2)(g) = math.max(maxHeight(i % 2)(g), maxHeight((i + 1) % 2)(p) * map(p)(g))
      }
    }
    println(f"${maxHeight((m + 1) % 2).max}%.2f")
    loop()
  }
}


