Problem: Malek is a rich man. He also is very generous. That's why he decided to split his money between poor people. A charity institute knows n poor people numbered from 1 to n. The institute gave Malek q recommendations. A recommendation is a segment of people like [l, r] which means the institute recommended that Malek gives one dollar to every person whose number is in this segment.

However this charity has very odd rules about the recommendations. Because of those rules the recommendations are given in such a way that for every two recommendation [a, b] and [c, d] one of the following conditions holds: 

  * The two segments are completely disjoint. More formally either a ≤ b < c ≤ d or c ≤ d < a ≤ b
  * One of the two segments are inside another. More formally either a ≤ c ≤ d ≤ b or c ≤ a ≤ b ≤ d. 



The goodness of a charity is the value of maximum money a person has after Malek finishes giving his money. The institute knows for each recommendation what is the probability that Malek will accept it. They want to know the expected value of goodness of this charity. So they asked you for help.

You have been given the list of recommendations and for each recommendation the probability of it being accepted by Malek. You have also been given how much money each person initially has. You must find the expected value of goodness.

Input

In the first line two space-separated integers n, q (1 ≤ n ≤ 105, 1 ≤ q ≤ 5000) are given.

In the second line n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) are given meaning that person number i initially has ai dollars. 

Each of the next q lines contains three space-separated numbers li, ri, pi (1 ≤ li ≤ ri ≤ n, 0 ≤ p ≤ 1) where li and ri are two integers describing the segment of recommendation and pi is a real number given with exactly three digits after decimal point which is equal to probability of Malek accepting this recommendation.

Note that a segment may appear several times in recommendations.

Output

Output the sought value. Your answer will be considered correct if its absolute or relative error is less than 10 - 6.

Examples

Input

5 2
1 7 2 4 3
1 3 0.500
2 2 0.500


Output

8.000000000


Input

5 2
281 280 279 278 282
1 4 1.000
1 4 0.000


Output

282.000000000


Input

3 5
1 2 3
1 3 0.500
2 2 0.250
1 2 0.800
1 1 0.120
2 2 0.900


Output

4.465000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
  bool operator()(const std::pair<T1, T2> &left,
                  const std::pair<T1, T2> &right) {
    Pred p;
    return p(left.second, right.second);
  }
};
using namespace std;
struct sol_t {
  int start, end;
  vector<double> p;
  vector<double> psum;
  sol_t() {}
  sol_t(int v) {
    start = end = v;
    p.push_back(1.0);
    psum.push_back(1.0);
  }
  sol_t(sol_t &s1, sol_t &s2) {
    start = max(s1.start, s2.start);
    end = max(s1.end, s2.end);
    p = vector<double>(end - start + 1);
    psum = vector<double>(end - start + 1);
    for (int v = start; v <= end; v++)
      p[v - start] = s1.fetchp(v) * s2.fetchpsum(v - 1) +
                     s1.fetchpsum(v - 1) * s2.fetchp(v) +
                     s1.fetchp(v) * s2.fetchp(v);
    update_psum();
  }
  double fetchp(int v) {
    if (!(start <= v && v <= end)) return 0.0;
    return p[v - start];
  }
  double fetchpsum(int v) {
    if (v < start) return 0.0;
    if (v > end) return 1.0;
    return psum[v - start];
  }
  void update(double prob) {
    end++;
    p.push_back(0.0);
    psum.push_back(-1);
    for (int v = end - 1; v >= start; v--) {
      p[v + 1 - start] += p[v - start] * prob;
      p[v - start] *= (1 - prob);
    }
    update_psum();
  }
  void update_psum() {
    for (int v = start; v <= end; v++) {
      psum[v - start] = p[v - start];
      if (v - 1 >= start) psum[v - start] += psum[v - 1 - start];
    }
  }
  double expectation() {
    double result = 0.0;
    for (int v = start; v <= end; v++) {
      result += v * p[v - start];
    }
    return result;
  }
};
int values[100000];
struct range_t {
  int a, b;
  double prob;
  int maxv;
  vector<int> child;
  sol_t solution;
  bool operator<(const range_t &other) const {
    if (a != other.a) return a < other.a;
    return (b - a) > (other.b - other.a);
  }
  void populate(int &pos, int nr);
  void solve();
} range[5000 + 1];
void range_t::populate(int &pos, int nr) {
  while (pos < nr && range[pos].b <= this->b) {
    this->child.push_back(pos);
    pos++;
    range[pos - 1].populate(pos, nr);
  }
}
void range_t::solve() {
  maxv = -1000000000;
  if (child.empty()) {
    for (int i = a; i <= b; i++) maxv = max(maxv, values[i]);
  } else {
    for (int i = a; i <= range[child.front()].a - 1; i++)
      maxv = max(maxv, values[i]);
    for (int k = 0; k + 1 < (int)child.size(); k++)
      for (int i = range[child[k]].b + 1; i <= range[child[k + 1]].a - 1; i++)
        maxv = max(maxv, values[i]);
    for (int i = range[child.back()].b + 1; i <= b; i++)
      maxv = max(maxv, values[i]);
  }
  solution = sol_t(maxv);
  for (int c : child) {
    range[c].solve();
    solution = sol_t(solution, range[c].solution);
  }
  solution.update(prob);
}
int main() {
  int n, nr;
  scanf("%d %d", &n, &nr);
  for (int i = 0; i < n; i++) scanf("%d", &values[i]);
  for (int r = 0; r < nr; r++)
    scanf("%d %d %lf", &range[r].a, &range[r].b, &range[r].prob), range[r].a--,
        range[r].b--;
  range[nr].a = 0, range[nr].b = n - 1, range[nr].prob = 0.0;
  nr++;
  sort(range, range + nr);
  int pos = 1;
  range[0].populate(pos, nr);
  range[0].solve();
  printf("%.8f\n", range[0].solution.expectation());
  return 0;
}