You are serving as the gamemaster of a two-player game in which several cubic dice are used.
Each face of the dice has a number on it.
Unlike conventional dice, the numbers are not necessarily one through six.
Before starting a game, you select a predefined number of dice from the set of dice at hand and deal them out to the two players.
Here, the numbers of dice the two players receive are not necessarily the same, but both players receive at least one die.
Both of the players cast all of the dice dealt in some situations of the game.
At that time, the greater the sum of the numbers on the top faces of the dice of a player is, the more advantage the player gains.
For more exciting games, selecting and dealing the dice in a way that achieves the least unfairness is the best.
Definition of the unfairness:
Let x denote the sum of the numbers on the top of the dice of one player, and y denote that of the other player.
The unfairness is defined as the expected value of (x − y)2.
Here, each side of a die comes to the top with probability 1/6 independently of the other dice.
Please compute the minimum achievable unfairness with the dice at hand.
The input consists of multiple datasets, each in the following format.
n m
a1,1 a1,2 a1,3 a1,4 a1,5 a1,6
⋮
an,1 an,2 an,3 an,4 an,5 an,6
n is the number of dice you have, and m is the number of dice you select to deal to players.
n and m are integers that satisfy 2 ≤ m ≤ n ≤ 60.
ai, j gives the number on the j-th face of the i-th die.
ai, j is an integer that satisfies 0 ≤ ai, j ≤ 60.
The end of the input is indicated by a line consisting of two zeros.
The number of datasets does not exceed 100.