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>
using namespace std;
const double inf = 1e20;
const double eps = 1e-10;
struct Line {
  double k, b;
  Line() = default;
  Line(double k_, double b_) : k(k_), b(b_) {}
};
bool operator<(const Line& a, const Line& b) {
  if (fabs(a.k - b.k) < eps) {
    return a.b + eps < b.b;
  }
  return a.k < b.k;
}
bool operator==(const Line& a, const Line& b) { return !(a < b) && !(b < a); }
vector<double> operator*(const vector<vector<double> >& mat,
                         const vector<double>& vec) {
  assert(vec.size() == mat[0].size());
  vector<double> result(vec.size(), 0);
  for (size_t i = 0; i < mat.size(); ++i) {
    for (size_t j = 0; j < mat[i].size(); ++j) {
      result[i] += mat[i][j] * vec[j];
    }
  }
  return result;
}
vector<vector<double> > operator*(const vector<vector<double> >& a,
                                  const vector<vector<double> >& b) {
  assert(a.size() == b.size());
  vector<vector<double> > result(a.size());
  for (size_t i = 0; i < a.size(); ++i) {
    result[i].assign(b[0].size(), 0);
    for (size_t j = 0; j < b[0].size(); ++j) {
      for (size_t k = 0; k < a[i].size(); ++k) {
        result[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  return result;
}
template <class S, class T>
ostream& operator<<(ostream& st, pair<S, T> p) {
  st << "(" << p.first << "," << p.second << ")";
  return st;
}
ostream& operator<<(ostream& st, const Line& l) {
  st << "(k=" << l.k << ", b=" << l.b << ")";
}
template <class T>
ostream& operator<<(ostream& st, vector<T> v) {
  st << "[";
  for (size_t i = 0; i < v.size(); ++i) {
    if (i != 0) {
      st << ", ";
    }
    st << v[i];
  }
  st << "]";
  return st;
}
double calc_x(const Line& l_a, const Line& l_b) {
  double x = -(l_a.b - l_b.b) / (l_a.k - l_b.k);
  return x;
}
vector<vector<double> > bin_pow(const vector<vector<double> >& base,
                                long long degree) {
  vector<vector<double> > result;
  if (degree == 0) {
    result.resize(base.size());
    for (size_t i = 0; i < base.size(); ++i) {
      result[i].assign(base[i].size(), 0);
      result[i][i] = 1;
    }
  } else if (degree % 2 == 1) {
    result = bin_pow(base, degree - 1) * base;
  } else {
    vector<vector<double> > buffer = bin_pow(base, degree / 2);
    result = buffer * buffer;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long t;
  cin >> n >> t;
  vector<double> a(n), b(n), p(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i] >> p[i];
  }
  double best_gain = 0;
  for (int i = 0; i < n; ++i) {
    best_gain = max(best_gain, b[i] * p[i]);
  }
  vector<Line> lines;
  for (int i = 0; i < n; ++i) {
    lines.push_back(Line(p[i], a[i] * p[i]));
  }
  sort(lines.begin(), lines.end());
  for (int i = 1; i < n; ++i) {
    if (fabs(lines[i - 1].k - lines[i].k) < eps) {
      double value = max(lines[i - 1].b, lines[i].b);
      lines[i - 1].b = value;
      lines[i].b = value;
    }
  }
  n = unique(lines.begin(), lines.end()) - lines.begin();
  lines.resize(n);
  vector<double> line_ids{0};
  vector<double> end_points;
  for (int i = 1; i < n; ++i) {
    while (line_ids.size() >= 2) {
      const Line& cur_line = lines[i];
      const Line& last_line = lines[line_ids.back()];
      double current_x = calc_x(cur_line, last_line);
      double prev_x = end_points.back();
      if (current_x + eps < prev_x) {
        line_ids.pop_back();
        end_points.pop_back();
      } else {
        break;
      }
    }
    double new_x = calc_x(lines[line_ids.back()], lines[i]);
    line_ids.push_back(i);
    end_points.push_back(new_x);
  }
  end_points.push_back(inf);
  long long cur_time = 0;
  double cur_me = 0;
  for (size_t i = 0; i < lines.size() && cur_time < t; ++i) {
    const Line& cur_line = lines[line_ids[i]];
    double cur_x = best_gain * cur_time - cur_me;
    double cur_limit = end_points[i];
    if (cur_x - eps > cur_limit) {
      continue;
    }
    vector<double> vec{cur_me, static_cast<double>(cur_time), 1};
    vector<vector<double> > base{
        {1 - cur_line.k, cur_line.k * best_gain, cur_line.b},
        {0, 1, 1},
        {0, 0, 1}};
    int max_power = 40;
    vector<long long> two_pow(max_power, 1);
    vector<vector<vector<double> > > base_pow(max_power, base);
    for (int st = 1; st < max_power; ++st) {
      two_pow[st] = two_pow[st - 1] * 2LL;
      base_pow[st] = base_pow[st - 1] * base_pow[st - 1];
    }
    for (int st = max_power - 1; st >= 0; --st) {
      long long next_time = cur_time + two_pow[st];
      if (next_time < t) {
        vector<double> next_vec = base_pow[st] * vec;
        double next_me = next_vec[0];
        double next_x = best_gain * next_time - next_me;
        if (next_x - eps < cur_limit) {
          cur_time = next_time;
          cur_me = next_me;
          vec = next_vec;
        }
      }
    }
    ++cur_time;
    vector<double> next_vec = base * vec;
    cur_me = next_vec[0];
  }
  cout << fixed << setprecision(12);
  cout << cur_me << endl;
  return 0;
}