#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 5010;
int n, m, Log[N], fc[20], st[18][N];
double f[M][M];
vector<int> G[M];
struct data {
  int l, r, mx;
  double p;
  data(int _l = 0, int _r = 0, int _m = 0, double _p = 0)
      : l(_l), r(_r), mx(_m), p(_p) {}
} q[M];
bool cmp(const data& A, const data& B) {
  return A.l == B.l ? A.r > B.r : A.l < B.l;
}
void dfs(int x) {
  double p = 1;
  for (auto v : G[x]) dfs(v);
  for (auto v : G[x]) p *= f[v][q[x].mx - q[v].mx];
  f[x][0] = (1 - q[x].p) * p;
  for (int i = 1; i <= m; ++i) {
    double p1 = 1, p2 = 1;
    for (auto v : G[x])
      p1 *= f[v][min(q[x].mx + i - q[v].mx - 1, m)],
          p2 *= f[v][min(q[x].mx + i - q[v].mx, m)];
    f[x][i] = q[x].p * p1 + (1 - q[x].p) * p2;
  }
}
int query(int l, int r) {
  int k = Log[r - l + 1];
  return max(st[k][l], st[k][r - fc[k] + 1]);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &st[0][i]);
  fc[0] = 1;
  for (int i = 1; i < 20; ++i) fc[i] = fc[i - 1] << 1;
  for (int i = 2; i <= n; ++i) Log[i] = Log[i >> 1] + 1;
  for (int j = 1; j < 17; ++j)
    for (int i = 1; i + fc[j] - 1 <= n; ++i)
      st[j][i] = max(st[j - 1][i], st[j - 1][i + fc[j - 1]]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%lf", &q[i].l, &q[i].r, &q[i].p);
    q[i].mx = query(q[i].l, q[i].r);
  }
  q[++m] = data(1, n, query(1, n), 0);
  sort(q + 1, q + m + 1, cmp);
  for (int i = 2; i <= m; ++i)
    for (int j = i - 1; j; --j)
      if (q[j].l <= q[i].l && q[i].r <= q[j].r) {
        G[j].push_back(i);
        break;
      }
  dfs(1);
  double ans = f[1][0] * q[1].mx;
  for (int i = 1; i <= m; ++i) ans += (f[1][i] - f[1][i - 1]) * (q[1].mx + i);
  printf("%lf\n", ans);
  return 0;
}
