#include <bits/stdc++.h>
const int N = 100000 + 10, LOGN = 18, M = 5000 + 10;
int n, m;
struct seg {
  int l, r;
  double q;
  inline bool operator<(const seg &s) const {
    return l == s.l ? r > s.r : l < s.l;
  }
} ss[M];
inline std::istream &operator>>(std::istream &ins, seg &s) {
  return ins >> s.l >> s.r >> s.q;
}
int st[LOGN][N], iloli[N];
inline void make_st(void) {
  iloli[0] = -1;
  for (int i = 1; i <= n; ++i) iloli[i] = iloli[i >> 1] + 1;
  for (int i = 1, ii = 1; i < LOGN; ++i, ii <<= 1)
    for (int j = 1; j + ii <= n; ++j)
      st[i][j] = std::max(st[i - 1][j], st[i - 1][j + ii]);
}
inline int query_st(int l, int r) {
  int len = r - l + 1, level = iloli[len];
  return std::max(st[level][l], st[level][r + 1 - (1 << level)]);
}
int maxv[M], depth[M];
double f[M][M];
int dfs(int u) {
  std::deque<int> q;
  depth[u] = 1;
  maxv[u] = query_st(ss[u].l, ss[u].r);
  int v = u + 1;
  while (v <= m) {
    if (ss[v].r > ss[u].r) break;
    int next = dfs(v);
    depth[u] = std::max(depth[u], depth[v] + 1);
    q.push_back(v);
    v = next + 1;
  }
  v -= 1;
  for (int i = 0; i <= depth[u]; ++i) {
    double f1 = i ? ss[u].q : 0, f2 = 1.0 - ss[u].q;
    for (auto v : q) {
      if (i + maxv[u] - maxv[v] - 1 >= 0 && i + maxv[u] - maxv[v] - 1 <= m + 1)
        f1 *= f[v][i + maxv[u] - maxv[v] - 1];
      if (i + maxv[u] - maxv[v] <= m + 1) f2 *= f[v][i + maxv[u] - maxv[v]];
    }
    f[u][i] = f1 + f2;
  }
  std::fill(f[u] + depth[u] + 1, f[u] + m + 2, 1.0);
  return v;
}
int main(void) {
  std::cin >> n >> m;
  for (int i = 1; i <= n; ++i) std::cin >> st[0][i];
  for (int i = 1; i <= m; ++i) std::cin >> ss[i];
  m += 1;
  ss[m].l = 1, ss[m].r = n, ss[m].q = 0;
  std::sort(ss + 1, ss + 1 + m);
  make_st();
  dfs(1);
  double ans = maxv[1] * f[1][0];
  for (int i = 1; i <= depth[1]; ++i)
    ans += (f[1][i] - f[1][i - 1]) * (maxv[1] + i);
  std::cout << std::fixed << std::setprecision(7) << ans;
}
