#include <bits/stdc++.h>
using namespace std;
int a[5001];
int b[5001];
double p[5001];
int t[100000];
vector<int> e[5001];
int v[5001];
double P[5001][5001];
double ans[5001];
vector<pair<int, int> > ord;
int seg_n;
int seg[1 << 18];
int max(int a, int b) { return a > b ? a : b; }
void init(int n) {
  seg_n = 1;
  while (seg_n < n) seg_n *= 2;
  for (int i = 0; i < seg_n * 2 - 1; i++) seg[i] = 0;
}
void update(int p, int x) {
  p += seg_n - 1;
  seg[p] = max(seg[p], x);
  while (p > 0) {
    p = (p - 1) / 2;
    seg[p] = max(seg[p], x);
  }
}
int query(int a, int b, int k = 0, int l = 0, int r = seg_n) {
  if (r <= a || b <= l) return 0;
  if (a <= l && r <= b) return seg[k];
  int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
  int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
  return max(vl, vr);
}
double solve(int i, int x, int m) {
  if (x > v[i] + m) return 1;
  if (x < v[i]) return 0;
  if (P[i][x - v[i]] != -1) return P[i][x - v[i]];
  int j;
  double res = 1;
  for (j = 0; j < e[i].size(); j++) {
    int k = e[i][j];
    res *= p[k] * solve(k, x - 1, m) + (1 - p[k]) * solve(k, x, m);
  }
  return P[i][x - v[i]] = res;
}
int main() {
  int n, m, i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &t[i]);
  a[0] = 0;
  b[0] = n - 1;
  p[0] = 0;
  for (i = 1; i <= m; i++) {
    scanf("%d %d %lf", &a[i], &b[i], &p[i]);
    a[i]--;
    b[i]--;
  }
  for (i = 0; i <= m; i++) ord.push_back(pair<int, int>(b[i] - a[i], -i));
  sort(ord.begin(), ord.end());
  reverse(ord.begin(), ord.end());
  for (i = 0; i <= m; i++) {
    int u = -ord[i].second;
    int pr = -1;
    for (j = i - 1; j >= 0; j--) {
      int k = -ord[j].second;
      if (a[k] <= a[u] && b[u] <= b[k]) {
        pr = k;
        break;
      }
    }
    e[pr].push_back(u);
  }
  init(n);
  for (i = 0; i < n; i++) update(i, t[i]);
  for (i = 0; i <= m; i++) v[i] = query(a[i], b[i] + 1);
  for (i = 0; i <= m; i++)
    for (j = 0; j <= m; j++) P[i][j] = -1;
  int M = v[0];
  for (i = 0; i <= m; i++) ans[i] = solve(0, M + i, m);
  for (i = m; i > 0; i--) ans[i] -= ans[i - 1];
  double sum = 0;
  for (i = 0; i <= m; i++) sum += (M + i) * ans[i];
  printf("%.12lf\n", sum);
  return 0;
}
