#include <bits/stdc++.h>
using namespace std;
int a[100010];
template <typename T>
struct RMQ {
  vector<vector<T> > v;
  void build(T *a, int n) {
    v.resize(n + 1);
    int d = 32 - __builtin_clz(n);
    for (int i = 1; i <= n; i++) v[i].resize(d), v[i][0] = a[i];
    for (int j = 1; (1 << j) <= n; j++)
      for (int i = 1; i + (1 << j) - 1 <= n; i++)
        v[i][j] = max(v[i][j - 1], v[i + (1 << j - 1)][j - 1]);
  }
  T query(int l, int r) {
    int d = 31 - __builtin_clz(r - l + 1);
    return max(v[l][d], v[r - (1 << d) + 1][d]);
  }
};
struct seg {
  int x, y;
  double z;
  seg(int x = 0, int y = 0, double z = 0) : x(x), y(y), z(z) {}
  bool operator<(const seg &s) const { return x == s.x ? y > s.y : x < s.x; }
};
int n, m;
seg s[5010];
int val[5010];
vector<int> adj[5010];
double dp[5010][5010], tmp[5010];
void dfs(int x) {
  for (int i = 0; i <= m; i++) dp[x][i] = 1;
  for (int i = 0; i < adj[x].size(); i++) {
    int y = adj[x][i];
    dfs(y);
    for (int i = 0; i <= m; i++) {
      int j = val[x] - val[y] + i;
      if (j <= m) dp[x][i] *= dp[y][j];
    }
  }
  for (int i = 0; i <= m; i++) tmp[i] = 0;
  for (int i = 0; i <= m; i++) {
    tmp[i] = (1 - s[x].z) * dp[x][i];
    if (i) tmp[i] += s[x].z * dp[x][i - 1];
  }
  for (int i = 0; i <= m; i++) dp[x][i] = tmp[i];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  RMQ<int> R;
  R.build(a, n);
  for (int i = 1; i <= m; i++) cin >> s[i].x >> s[i].y >> s[i].z;
  sort(s + 1, s + m + 1);
  s[0] = seg(1, n, 0);
  for (int i = 0; i <= m; i++) val[i] = R.query(s[i].x, s[i].y);
  vector<int> v;
  v.push_back(0);
  for (int i = 1; i <= m; i++) {
    while (s[v.back()].y < s[i].x) v.pop_back();
    adj[v.back()].push_back(i);
    v.push_back(i);
  }
  dfs(0);
  double ans = 0;
  for (int i = 0; i <= m; i++) {
    double p = dp[0][i];
    if (i) p -= dp[0][i - 1];
    ans += (val[0] + i) * p;
  }
  printf("%.10lf\n", ans);
}
