Problem: The rabbit, who successfully defeated the ambushed enemy, succeeded in advancing the hero into the enemy's castle. When the hero released the cats trapped in the castle dungeon, some of them were the hero's. It will help me.

According to the cats, to reach the Demon King in the back of the castle, you will have to go through n rooms from 1 to n in this order, but one enemy is waiting in each room and you will defeat them one by one. For each of the m cats that became friends, the winning rate against each enemy in each room is known, and the main character dispatches these cats one by one to the back of the castle. Each room Can only pass after defeating the enemy there, so if one cat is killed by an enemy in one room, the next cat will fight from the enemy in that room.

The dispatched cat will proceed until it is killed by the enemy, but each time you know which room the dispatched cat was killed by the enemy, you can decide which cat to dispatch next. For example, will the cats have the greatest chance of defeating all the enemies awaiting them?



Input

The first line of input is given with m and n separated by spaces. 1 ≤ m, n ≤ 16

The next m line is given n real numbers that represent the probability that the cat will beat the enemy. The jth real number in the i + 1st line represents the probability that the cat will beat the enemy in room j. Is up to 3 digits after the decimal point.

Output

Answer the probability when you decide the order so that the cats have the maximum probability of defeating all the enemies waiting for them. The output may contain errors, but the error from the true value is 10-9. Within.

Example

Input

2 3
0.900 0.500 0.100
0.500 0.500 0.500


Output

0.372500000000

Solution (in CPP):

Solution:
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

const int N = 16;
const int M = 16;
const int T = (1<<N);
const double INF = (1<<30);

int n,m;
double cat[N][M];
double memo[2][T][N];

void input(){
	cin>>n>>m;
	rep(i,n)rep(j,m)cin>>cat[i][j];
}

bool has(int state, int i){
	return (state&(1<<i))>0;
}

string bitstr(int state){
	string ret = "";
	rep(i,n) ret += has(state,i) ? "1" : "0";
	return ret;
}

void setEdge(int state, int e[N], int* esum){
	(*esum)=0;
	rep(i,n){
		if(has(state,i)){
			e[(*esum)]=i;
			(*esum)++;
		}
	}
}

double solve_dp(){
	rep(i,2)rep(j,T)rep(k,N)memo[i][j][k]=0;
	
	int t = (1<<n);
	for(int i=m-1;i>=0;i--){
		rep(j,T)rep(k,N)memo[i%2][j][k]=0;
		rep(j,t){
			int edge[N];
			int esum = 0;
			setEdge(j, edge, &esum);
			
			rep(k,n){
				if(!has(j,k))continue;
				double maxi = 0;
				double val1=0;
				double winrate = cat[k][i];
				
				if(i!=m-1)val1 = winrate * memo[(i+1)%2][j][k];
				else val1 = winrate;
				
				maxi = max(maxi, val1);
				
				int dstate = j^(1<<k);
				rep(p,esum){
					int e = edge[p];
					if(!has(dstate,e))continue;
					maxi = max(maxi, val1 + (1-winrate)*memo[i%2][dstate][e]);
				}
				memo[i%2][j][k] = maxi;
			}
		}
	}
	
	double ans = 0;
	rep(i,n) ans = max(ans, memo[0][t-1][i]);
	
	return ans;
}
double solve(){
	
	return solve_dp();
}

int main(){
	input();
	printf("%.12f\n",solve());
}