Problem: Ivan plays some computer game. There are n quests in the game. Each quest can be upgraded once, this increases the reward for its completion. Each quest has 3 parameters a_{i}, b_{i}, p_{i}: reward for completing quest before upgrade, reward for completing quest after upgrade (a_{i} < b_{i}) and probability of successful completing the quest.

Each second Ivan can try to complete one quest and he will succeed with probability p_{i}. In case of success Ivan will get the reward and opportunity to upgrade any one quest (not necessary the one he just completed). In case of failure he gets nothing. Quests do not vanish after completing.

Ivan has t seconds. He wants to maximize expected value of his total gain after t seconds. Help him to calculate this value.

Input

First line contains 2 integers n ( 1 ≤ n ≤ 10^{5}) and t ( 1 ≤ t ≤ 10^{10}) — number of quests and total time.

Following n lines contain description of quests. Each description is 3 numbers a_{i} b_{i} p_{i} (1 ≤ a_{i} < b_{i} ≤ 10^{8}, 0 < p_{i} < 1) — reward for completing quest before upgrade, reward for completing quest after upgrade and probability of successful completing of quest. a_{i} and b_{i} are integers. All probabilities are given with at most 9 decimal places.

Output

Print the expected value.

Your answer will be accepted if absolute or relative error does not exceed 10^{-6}. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if (|a-b|)/(max⁡(b,    1)) ≤ 10^{-6}.

Examples

Input

3 2
3 1000 0.5
1 2 0.48
3 20 0.3


Output

252.2500000000000


Input

2 2
1 1000 0.1
2 3 0.2


Output

20.7200000000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int n;
long long t;
const int maxN = (int)1e5 + 100;
const long double eps = 1e-12;
int a[maxN], b[maxN];
long double p[maxN];
long double C = 0;
bool cmp(int i, int j) {
  if (abs(p[i] - p[j]) < eps) return a[i] < a[j];
  return p[i] < p[j];
}
const int LG = 40;
long double mat[LG][3][3];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> t;
  vector<int> f;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> p[i];
    C = max(C, b[i] * p[i]);
    f.push_back(i);
  }
  sort(f.begin(), f.end(), cmp);
  vector<int> fin;
  for (int i = 0; i < f.size(); i++) {
    while (!fin.empty() &&
           p[fin.back()] * a[fin.back()] + eps < p[f[i]] * a[f[i]])
      fin.pop_back();
    fin.push_back(f[i]);
  }
  long double cur_dp = 0;
  long long cur_t = 0;
  for (int i = 0; i < fin.size(); i++) {
    long double cut_point = 1e100;
    if (i + 1 < fin.size()) {
      cut_point = (p[fin[i]] * a[fin[i]] - p[fin[i + 1]] * a[fin[i + 1]]) /
                  (p[fin[i + 1]] - p[fin[i]]);
    }
    for (int a = 0; a < 3; a++) {
      for (int b = 0; b < 3; b++) {
        mat[0][a][b] = 0;
      }
    }
    mat[0][0][0] = 1 - p[fin[i]];
    mat[0][0][1] = C * p[fin[i]];
    mat[0][0][2] = p[fin[i]] * a[fin[i]];
    mat[0][1][1] = mat[0][1][2] = mat[0][2][2] = 1;
    for (int it = 0; it + 1 < LG; it++) {
      for (int a = 0; a < 3; a++) {
        for (int b = 0; b < 3; b++) {
          mat[it + 1][a][b] = 0;
        }
      }
      for (int a = 0; a < 3; a++) {
        for (int b = 0; b < 3; b++) {
          for (int c = 0; c < 3; c++) {
            mat[it + 1][a][c] += mat[it][a][b] * mat[it][b][c];
          }
        }
      }
    }
    for (int it = LG - 1; it >= 0; it--) {
      long long nxt = (cur_t + (1LL << it));
      if (nxt >= t) continue;
      long double will_dp =
          cur_dp * mat[it][0][0] + cur_t * mat[it][0][1] + mat[it][0][2];
      if (C * nxt - will_dp < cut_point) {
        cur_t = nxt;
        cur_dp = will_dp;
      }
    }
    if (C * cur_t - cur_dp < cut_point) {
      cur_dp = cur_dp * (1 - p[fin[i]]) + p[fin[i]] * (a[fin[i]] + C * cur_t);
      cur_t++;
    }
    if (cur_t == t) break;
  }
  cout << fixed << setprecision(12) << cur_dp;
  return 0;
}