#include <cstdio>
#include <cstring>
#include <algorithm>
#include <functional>
#include <vector>
#include <cmath>
#include <cassert>

using namespace std;

const int maxN = 30;
const int maxM = 30;
const int maxP = 100000;
const int maxT = 10000000;
const int maxS = 100000;
const int maxV = maxN * 3 + 2;

const int iter = 50;
const int flowIter = 50;
const double eps = 1e-9;

struct edge
{
  double c, f;
  int to, r;
  edge() {}
  edge( int _to, double _c, int _r ):
    c(_c), f(0), to(_to), r(_r) {}
};

int n, m, p[maxN], r[maxN], d[maxN], s[maxM];
vector <edge> c[maxV];
int vs, vt, nv;
bool u[maxN];

int addV() { c[nv].clear(); return nv++; }
void addE( int a, int b, double ca )
{
  c[a].push_back(edge(b, ca, c[b].size()));
  c[b].push_back(edge(a, 0, c[a].size() - 1));
}

bool dfs( int v, double d )
{
  if (v == vt)
    return true;
  u[v] = true;
  for (int i = 0; i < (int)c[v].size(); i++)
  {
    edge &t = c[v][i];
    if (t.f + d <= t.c && !u[t.to] && dfs(t.to, d))
    {
      t.f += d, c[t.to][t.r].f -= d;
      return true;
    }
  }
  return false;
}

double maxFlow()
{
  double cu = 1 << 20, sum = 0;
  for (int i = 0; i < flowIter; i++, cu *= 0.5)
    while (true)
    {
      memset(u, 0, sizeof(u));
      if (!dfs(vs, cu))
        break;
      sum += cu;
    }
  return sum;
}

bool check( double add )
{
  nv = 0;
  vs = addV();
  vt = addV();
  int vj = nv;
  for (int i = 0; i < n; i++)
    addE(addV(), vt, (double)p[i]);
  vector <double> ti;
  for (int i = 0; i < n; i++)
  {
    ti.push_back((double)r[i]);
    ti.push_back(d[i] + add);
  }
  sort(ti.begin(), ti.end());
  ti.resize(unique(ti.begin(), ti.end()) - ti.begin());
  for (int i = 1; i < (int)ti.size(); i++)
  {
    double dt = ti[i] - ti[i - 1];
    int vc = nv;
    for (int j = 0; j < m; j++)
      addE(vs, addV(), s[j] * (j + 1) * dt);
    for (int j = 0; j < m; j++)
      for (int k = 0; k < n; k++)
        if (r[k] - eps <= ti[i - 1] &&
          ti[i] <= d[k] + add + eps)
          addE(vc + j, vj + k, s[j] * dt);
  }
  int need = 0;
  for (int i = 0; i < n; i++)
    need += p[i];
  return fabs(maxFlow() - need) < eps;
}

int main()
{
  freopen("cheese.in", "r", stdin);
  freopen("cheese.out", "w", stdout);

  assert(scanf("%d%d", &n, &m) == 2);
  assert(1 <= n && n <= maxN);
  assert(1 <= m && m <= maxM);
  for (int i = 0; i < n; i++)
  {
    assert(scanf("%d%d%d", &p[i], &r[i], &d[i]) == 3);
    assert(1 <= p[i] && p[i] <= maxP);
    assert(0 <= r[i] && r[i] < d[i] && d[i] <= maxT);
  }
  for (int i = 0; i < m; i++)
  {
    assert(scanf("%d", &s[i]) == 1);
    assert(1 <= s[i] && s[i] <= maxS);
  }
  sort(s, s + m, greater <int>());
  for (int i = 0; i < m - 1; i++)
    s[i] -= s[i + 1];
  double mi = 0, ma = maxN * maxP;
  for (int i = 0; i < iter; i++)
  {
    double av = (mi + ma) * 0.5;
    if (check(av))
      ma = av;
    else
      mi = av;
  }
  printf("%.7lf\n", mi);

  return 0;
}
