#include <bits/stdc++.h>
using namespace std;
int inf = 2e9 + 7;
const int MAXN = 1e5 + 7;
int n, m, bd, inc, dam;
int maxh[MAXN], hi[MAXN], maxt[MAXN];
int sum[MAXN << 2], cnt[MAXN << 2];
struct node {
  int h, t;
  node() {}
  node(int h, int t) : h(h), t(t) {}
  bool operator<(const node &b) const { return t < b.t; }
};
vector<int> id;
vector<int> L[MAXN], R[MAXN];
vector<node> q[MAXN];
int get_id(int x) {
  return (lower_bound(id.begin(), id.end(), x) - id.begin());
}
void Discrete() {
  for (int i = 1; i <= n; i++) sort(q[i].begin(), q[i].end());
  for (int i = 1; i <= n; i++) {
    L[i].push_back(0);
    R[i].push_back(0);
    for (int j = 0; j < q[i].size(); j++) {
      int l = q[i][j].t, r;
      if (dam < q[i][j].h)
        r = l;
      else {
        if (hi[i] == 0) {
          if (j + 1 < q[i].size())
            r = q[i][j + 1].t;
          else
            r = inf;
        } else {
          int ti = (dam - q[i][j].h) / hi[i];
          r = l + ti + 1;
        }
      }
      int sz = R[i].size();
      if (l <= R[i][sz - 1])
        R[i][sz - 1] = r;
      else {
        L[i].push_back(l);
        R[i].push_back(r);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < L[i].size(); j++) {
      id.push_back(L[i][j]);
      id.push_back(R[i][j]);
    }
  }
  sort(id.begin(), id.end());
  id.erase(unique(id.begin(), id.end()), id.end());
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < L[i].size(); j++) {
      cnt[get_id(L[i][j])]++;
      cnt[get_id(R[i][j])]--;
    }
  }
}
int main() {
  int minh = 0x3f3f3f3f;
  scanf("%d%d", &n, &m);
  scanf("%d%d%d", &bd, &inc, &dam);
  for (int i = 1; i <= n; i++) {
    int h;
    scanf("%d%d%d", &maxh[i], &h, &hi[i]);
    minh = min(minh, maxh[i]);
    q[i].push_back(node(h, 0));
  }
  for (int i = 1; i <= m; i++) {
    int t, id, h;
    scanf("%d%d%d", &t, &id, &h);
    q[id].push_back(node(h, t));
  }
  if (minh <= dam && inc != 0) {
    puts("-1");
    return 0;
  }
  Discrete();
  if (id[id.size() - 1] == inf && inc != 0) {
    puts("-1");
    return 0;
  }
  memset(maxt, -1, sizeof(maxt));
  sum[0] = cnt[0];
  maxt[sum[0]] = max(maxt[sum[0]], id[0]);
  for (int i = 1; i < id.size(); i++) {
    maxt[sum[i - 1]] = max(maxt[sum[i - 1]], id[i] - 1);
    sum[i] = sum[i - 1] + cnt[i];
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++)
    if (maxt[i] != -1) ans = max(ans, i * (bd + (long long)inc * maxt[i]));
  cout << ans << endl;
  return 0;
}
