p01548 Audition_36595
Idol --- It's the eternal longing of girls. However, only a handful stand at the top. You have decided to enter such a survival world as an idol producer. And today, I will take your idol and challenge an important audition.

The three elements that determine the audition are visual, dance, and vocal. There are m appeal times during the audition, and each idol can make a visual appeal, a dance appeal, or a vocal appeal for each appeal time. When you make a visual appeal, the idol's visual points are only her visual value, when you make a dance appeal, the dance points are only her dance value, and when you make a vocal appeal, the vocal points are only her vocal value. Will rise.

After m appeals, 3 of the N idols with the highest visual points have 5 audition points, 3 with the highest dance points have 3 audition points, and 3 with the highest vocal points. 2 Earn audition points. On the other hand, if the visual points are the lowest, the audition points will be deducted by 1 point, if the dance points are the lowest, the audition points will be deducted by 1 point, and if the vocal points are the lowest, the audition points will be deducted by 1 point. (Even if the audition point is 1 or less, 1 point will be deducted from it).

At the beginning of the audition, each idol has 0 visual points, dance points, and vocal points. You are the producer of Idol 1 and you can tell which appeal to make at each appeal time. Idols other than Idol 1 will randomly make one of the appeals at equal probability at each appeal time (that is, each with a one-third chance). If idol 1 has the same visual, dance, and vocal points as other idols, idol 1 is always inferior. Find the expected value when instructed to maximize the expected value of the audition points earned by Idol 1. The fate of an idol depends on your instructions!

By the way, all instructions are given before the audition starts, and the instructions cannot be changed during the audition after that. In other words, it is not possible for other idols to see which appeal they have made since the audition began and then give instructions to maximize the expected value in that case.



Input

The input is given in the form:

> n m
> vi1 da1 vo1
> vi2 da2 vo2
> ...
> vin dan von
>

The first line shows the number of idols participating in the audition n (4 ≤ n ≤ 2000) and the number of appeal times in this audition m (1 ≤ m ≤ 2000). The next n lines contain the visual value vii, dance value dai, and vocal value voi (1 ≤ vii, dai, voi ≤ 10,000) for idle i, respectively.

Output

Output the maximum expected value of audition points earned by idle 1 in one line.

Examples

Input

4 1
1 1 1
1 1 1
1 1 1
1 1 1


Output

2.777777777778


Input

4 10
1 1 1
10 10 10
10 10 10
10 10 10


Output

-2.335340954780


Input

9 9
13 5 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1


Output

4.678837855075
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, m, a[2000], b[2000], c[2000];
double sum[2010], e[3][2010], dp[4][2010];

void calc(double *e, int *v, int bonus){
	rep(i, m + 1){
		double dp[4] = {}, p = 1;
		dp[0] = 1;
		for(int j = 1; j < n; j++){
			int need = (v[0] * i + v[j] - 1) / v[j] - 1;
			double w = need < 0 ? 0 : sum[min(m, need)];
			
			p *= 1 - w;
			for(int k = 2; k >= 0; k--){
				dp[k + 1] += dp[k] * (1 - w);
				dp[k] *= w;
			}
		}
		e[i] = (dp[0] + dp[1] + dp[2]) * bonus - p;
	}
}

int main(){
	cin >> n >> m;
	sum[0] = 1;
	rep(i, m) for(int j = i; j >= 0; j--){
		sum[j + 1] += sum[j] / 3;
		sum[j] *= 2 / 3.0;
	}
	rep(i, m) sum[i + 1] += sum[i];
	
	rep(i, n) cin >> a[i] >> b[i] >> c[i];
	calc(e[0], a, 5);
	calc(e[1], b, 3);
	calc(e[2], c, 2);
	
	rep(i, 4) rep(j, m + 1) dp[i][j] = -INF;
	dp[0][0] = 0;
	rep(i, 3) rep(j, m + 1) if(dp[i][j] > -INF){
		rep(k, m - j + 1) dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] + e[i][k]);
	}
	printf("%.9f\n", dp[3][m]);
	
	return 0;
}
4 1
1 1 1
1 1 1
1 1 1
1 1 1 9 9
13 5 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 4 10
1 1 1
10 10 10
10 10 10
10 10 10 4 1
1 1 1
1 1 1
1 1 2
1 1 1 9 9
13 5 19
19 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
55 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
37 23 25
55 29 19
13 19 11
21 1 15
7 13 1 9 9
13 5 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 4
13 19 11
21 5 15
7 13 1 4 10
1 1 1
10 10 10
10 10 10
10 6 10 9 16
13 5 19
19 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 4 1
2 1 1
1 1 1
1 1 2
1 2 1 9 6
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
33 29 19
13 19 11
21 1 15
7 13 1 9 7
13 5 19
19 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 12
21 1 15
7 13 1 9 9
13 9 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 4
13 12 11
21 5 15
7 13 1 9 10
13 4 19
19 10 37
15 1 7
7 11 24
21 23 25
33 29 19
13 21 11
21 5 15
7 13 1 9 6
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
33 29 17
13 19 10
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
55 29 19
13 19 11
21 1 22
7 38 1 9 10
13 5 19
19 21 59
25 1 7
7 11 33
37 23 25
55 26 19
13 19 11
21 1 15
7 13 1 9 6
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
33 29 17
13 19 10
40 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
55 29 19
13 19 9
21 1 22
7 38 1 9 9
13 9 3
19 21 37
15 1 7
7 11 17
21 23 25
33 29 4
13 12 11
21 5 15
7 13 1 9 10
13 1 19
19 21 59
25 1 7
7 11 33
37 23 25
59 26 19
13 19 11
21 1 15
7 13 1 9 9
13 2 3
19 21 37
15 1 7
7 11 17
21 23 25
33 29 4
13 12 11
21 5 15
7 13 1 9 9
13 2 3
19 21 37
15 1 7
7 11 17
21 23 25
33 29 4
13 12 11
29 5 15
7 13 1 9 10
13 1 19
19 21 59
23 1 7
7 11 33
37 23 25
59 27 19
13 19 11
21 1 15
7 13 1 9 6
13 5 19
19 21 37
15 1 7
7 11 52
21 23 25
33 29 17
13 38 6
40 1 15
9 13 1 9 9
13 2 3
19 21 25
15 1 7
12 11 17
21 23 25
33 29 4
13 12 11
29 5 15
7 13 1 9 6
13 5 26
19 21 37
15 1 7
7 11 52
21 23 25
33 29 17
13 38 6
40 1 15
9 13 1 9 9
13 2 3
19 21 25
7 1 7
12 11 17
21 23 25
33 29 4
13 12 11
29 5 15
7 13 1 9 9
13 2 6
19 21 25
7 1 7
12 11 31
21 23 25
33 48 4
13 12 11
29 5 14
7 13 1 9 9
13 2 6
32 21 25
7 1 7
12 11 31
21 23 25
33 48 4
13 12 11
29 5 14
7 13 1 9 9
13 2 6
32 21 25
7 1 9
12 11 31
21 23 25
33 48 4
13 12 11
29 5 14
7 13 2 9 9
13 5 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 19
13 19 11
21 5 15
11 13 1 4 10
1 1 2
10 10 10
10 10 10
10 10 10 4 0
1 1 1
1 1 1
1 1 2
1 1 1 9 10
13 5 19
7 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 9 10
13 5 19
19 21 37
8 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
33 29 13
13 19 11
21 1 15
7 13 1 9 10
24 5 19
19 21 37
15 1 7
7 11 33
21 23 25
55 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
70 23 25
55 29 19
13 19 11
21 1 15
7 13 1 9 16
13 5 19
19 21 37
15 1 7
7 11 24
11 23 25
33 29 19
13 19 11
21 5 15
7 13 1 8 10
13 5 19
19 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 21 11
21 5 15
7 13 1 9 6
13 5 19
19 21 37
25 1 7
7 11 33
21 23 25
33 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 3 33
21 23 25
55 29 19
13 19 11
21 1 15
7 25 1 9 10
13 10 19
19 21 59
15 1 7
7 11 33
37 23 25
55 29 19
13 19 11
21 1 15
7 13 1 9 9
13 5 19
19 21 37
15 1 10
7 11 15
21 23 25
33 29 4
13 12 11
21 5 15
7 13 1 7 6
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
33 29 19
13 19 10
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
12 11 33
21 23 25
55 29 19
13 19 11
21 1 15
7 38 1 9 9
13 9 22
19 21 37
15 1 7
7 11 15
21 23 25
33 29 4
13 12 11
21 5 15
7 13 1 9 7
13 5 19
19 21 37
15 1 7
7 11 24
12 23 25
33 29 19
13 19 12
21 1 16
7 13 1 9 10
13 4 19
19 21 37
15 1 7
7 11 33
21 23 25
55 29 19
13 19 11
21 1 22
7 38 1 1 10
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
55 29 19
13 19 9
21 1 22
7 38 1 9 9
13 9 3
13 21 37
15 1 7
7 11 17
21 23 25
33 29 4
13 12 11
21 5 15
7 13 1 9 10
7 5 19
19 21 37
15 1 7
7 11 24
21 36 25
33 29 19
13 19 12
21 1 16
7 13 1 9 6
13 5 19
30 21 37
15 1 7
7 11 33
21 23 25
33 29 17
13 38 10
40 1 15
7 13 1 9 6
13 5 19
19 21 37
15 1 7
7 11 52
3 23 25
33 29 17
13 38 10
40 1 15
7 13 1 9 10
13 1 19
19 21 59
25 1 7
7 11 33
37 23 25
59 27 19
5 19 11
21 1 15
7 13 1 9 10
13 1 19
19 21 59
23 1 1
7 11 33
37 23 25
59 27 19
13 19 11
21 1 15
7 13 1 9 6
13 5 26
19 21 37
19 1 7
7 11 52
21 23 25
33 29 17
13 38 6
40 1 15
9 13 1 9 6
22 5 26
19 21 37
15 1 7
7 11 52
21 23 25
33 55 17
13 38 6
40 1 15
9 13 1 9 9
13 2 3
19 21 25
7 1 7
12 11 31
21 23 25
33 29 4
13 12 11
16 5 14
7 13 1 9 9
13 2 6
32 21 25
7 1 7
12 11 31
21 23 25
33 48 8
13 12 11
29 5 14
7 13 1 9 9
13 2 1
32 21 25
7 1 9
12 11 31
21 23 25
33 48 4
13 12 11
29 5 14
7 13 2 9 15
13 5 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 19
13 19 11
21 5 15
11 13 1 9 10
13 8 19
7 21 37
15 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 9 10
21 5 19
19 21 37
8 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 11 33
21 23 25
33 29 13
18 19 11
21 1 15
7 13 1 9 10
24 5 19
19 21 37
15 1 7
7 11 33
21 1 25
55 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 23
19 21 37
15 1 7
7 11 33
70 23 25
55 29 19
13 19 11
21 1 15
7 13 1 9 9
13 5 19
19 21 64
15 1 7
7 11 15
21 23 25
33 29 4
8 19 11
21 5 15
7 13 1 9 16
13 5 19
19 21 1
15 1 7
7 11 24
11 23 25
33 29 19
13 19 11
21 5 15
7 13 1 8 10
13 5 19
19 21 37
15 1 9
7 11 24
21 23 25
33 29 19
13 21 11
21 5 15
7 13 1 9 10
13 5 19
19 21 37
15 1 7
7 3 33
21 23 25
55 29 19
13 19 11
31 1 15
7 25 1 9 10
13 10 1
19 21 59
15 1 7
7 11 33
37 23 25
55 29 19
13 19 11
21 1 15
7 13 1 6 10
13 5 19
19 21 37
15 1 7
12 11 33
21 23 25
55 29 19
13 19 11
21 1 15
7 38 1 9 7
20 5 19
19 21 37
15 1 7
7 11 24
12 23 25
33 29 19
13 19 12
21 1 16
7 13 1 9 10
13 1 19
6 21 59
25 1 7
7 4 33
37 23 25
55 26 19
13 19 11
21 1 15
7 13 1 9 10
7 5 19
19 21 37
26 1 7
7 11 24
21 36 25
33 29 19
13 19 12
21 1 16
7 13 1 9 6
13 5 30
30 21 37
15 1 7
7 11 33
21 23 25
33 29 17
13 38 10
40 1 15
7 13 1 9 9
13 2 3
19 21 37
15 1 7
1 11 17
21 23 25
33 29 4
13 12 5
29 5 15
7 13 1 9 9
13 2 3
34 21 25
15 1 7
12 11 17
21 36 25
33 29 4
13 12 11
29 5 15
7 13 1 8 6
13 5 26
19 21 37
19 1 7
7 11 52
21 23 25
33 29 17
13 38 6
40 1 15
9 13 1 9 6
22 5 26
19 21 37
15 1 7
7 11 52
21 23 25
22 55 17
13 38 6
40 1 15
9 13 1 9 9
13 2 6
19 21 25
7 1 7
12 11 31
21 23 50
33 48 4
13 12 11
35 5 14
7 13 1 9 9
13 2 1
32 21 25
7 1 9
4 11 31
21 23 25
33 48 4
13 12 11
29 5 14
7 13 2 9 9
13 2 6
32 21 43
7 1 9
12 11 31
21 23 25
8 48 4
13 12 11
29 5 21
7 13 2 9 15
13 5 19
19 21 37
15 1 7
7 11 15
21 23 25
33 29 19
13 19 11
21 5 15
11 13 2 9 10
13 8 19
7 21 37
15 1 4
7 11 24
21 23 25
33 29 19
13 19 11
21 5 15
7 13 1 9 10
21 6 19
19 21 37
8 1 7
7 11 24
21 23 25
33 29 19
13 19 11
21 1 15
7 13 1 9 10
13 5 19
19 21 37
15 1 14
7 11 33
21 23 25
33 29 13
18 19 11
21 1 15
7 13 1 9 10
13 5 23
19 21 37
15 1 7
7 11 33
70 23 25
55 29 38
13 19 11
21 1 15
7 13 1 9 9
1 5 19
19 21 64
15 1 7
7 11 15
21 23 25
33 29 4
8 19 11
21 5 15
7 13 1 9 16
13 5 19
19 21 1
15 1 7
7 11 24
11 23 25
33 29 19
12 19 11
21 5 15
7 13 1 9 10
13 10 1
19 21 59
15 1 7
7 11 33
37 23 25
55 29 19
24 19 11
21 1 15
7 13 1 7 6
13 5 19
19 21 37
15 1 7
7 11 33
11 23 19
33 29 19
13 19 10
21 1 15
7 13 1 9 10
13 4 19
25 10 37
15 1 7
6 11 24
21 23 25
33 29 19
13 21 11
21 5 15
7 21 1 7 10
13 5 19
19 21 59
25 1 7
7 11 33
37 23 25
55 34 35
13 19 11
21 1 15
7 13 1 9 6
13 5 11
19 21 37
15 1 7
7 11 33
21 23 25
33 29 17
13 19 10
55 1 15
1 13 1 9 10
13 1 19
6 21 59
34 1 7
7 4 33
37 23 25
55 26 19
13 19 11
21 1 15
7 13 1 9 9
13 2 3
19 21 37
20 1 7
7 11 22
21 44 25
33 29 4
13 12 11
21 5 15
7 13 1 9 6
13 5 19
19 21 37
17 1 7
7 11 52
3 23 25
33 29 17
13 38 10
40 1 28
7 13 1
2.777777777778 4.678837855075 -2.335340954780 2.777777777778
 4.678653576155
 4.622435010869
 4.770103921656
 4.600994759799
 4.010306932100
 4.682566517665
 -2.000435200955
 4.967379429911
 3.000000000000
 3.885396994018
 4.570861560256
 4.802974374730
 4.511955943316
 3.899119623837
 4.600984133527
 3.498844123422
 3.523515679257
 4.600990132827
 4.281095505703
 3.372761232615
 3.767986287108
 3.595336295377
 3.651746895793
 3.552104491380
 3.593888422115
 3.656999563548
 3.606263479260
 3.893704512602
 3.581014285706
 3.156399140927
 4.678781207220
 -1.646337900103
 -3.000000000000
 4.791380172659
 4.789381744954
 4.770142211535
 6.016623699919
 3.774031801020
 4.978559545187
 4.329155570783
 3.622376159401
 4.604611617428
 4.051205948000
 4.680288737989
 4.228302960402
 4.600404235577
 4.887951557395
 4.778914106516
 4.466987618517
 7.000000000000
 4.396195500190
 1.556030560092
 3.057902468609
 3.923173363990
 3.373522568215
 3.651778795215
 3.482650853929
 5.955214061016
 3.860953465381
 3.576773396984
 2.899489173426
 4.952128161931
 4.877095245868
 6.090170171150
 4.696885329504
 6.048723311377
 3.774271112761
 4.691701893678
 5.089184525341
 4.299003362168
 4.328957297835
 3.843589636814
 4.621938505416
 5.456519060089
 3.534416919918
 1.523559940552
 3.157732657341
 3.599072008874
 3.083043074296
 3.482244971522
 6.168262537196
 3.753838865921
 2.899557359168
 3.812661514553
 4.944796363821
 4.877117444814
 6.125790728324
 4.696852673726
 3.774087588949
 1.189629326330
 5.109645758194
 3.493300641640
 4.798082960414
 4.298268937605
 3.440169130326
 3.503142485590
 3.164089328632
 3.617336650759
 3.909450734172
