#include <bits/stdc++.h>
using namespace std;
void readi(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readll(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readc(char &x) {
  char c;
  while ((c = getchar()) == ' ')
    ;
  x = c;
}
void writes(string s) { puts(s.c_str()); }
void writeln() { writes(""); }
void writei(int x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
void writell(long long x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
long long qp(long long x, long long y) {
  if (y == 0) return 1;
  if (y == 1) return x;
  long long z = qp(x, y / 2);
  z = z * z % 1000000007;
  if (y & 1) z = z * x % 1000000007;
  return z;
}
long long n, m, i, j, h[100005], mxh[100005], sub[100005], adh[100005], ti, ans,
    s, shang, gt, adgt, ccc;
struct upd {
  long long ti, id, nh;
} a[200005];
vector<long long> up[200005];
map<long long, long long> mp, cnt;
set<long long> all;
bool cmp(long long x, long long y) { return a[x].ti < a[y].ti; }
int main() {
  ios::sync_with_stdio(false);
  ;
  cin >> n >> m >> gt >> adgt >> shang;
  for (i = 1; i <= n; i++) {
    cin >> mxh[i] >> h[i] >> adh[i];
    a[i] = {0, i, h[i]};
    up[i].push_back(i);
    if (mxh[i] <= shang && adgt) {
      cout << -1;
      return 0;
    }
  }
  all.insert(0);
  all.insert(1);
  for (i = 1 + n; i <= n + m; i++) {
    cin >> a[i].ti >> a[i].id >> a[i].nh;
    up[a[i].id].push_back(i);
    all.insert(a[i].ti);
  }
  for (i = 1; i <= n; i++) stable_sort((up[i]).begin(), (up[i]).end(), cmp);
  for (i = 1; i <= n; i++) {
    for (j = 0; j < up[i].size(); j++) {
      if (a[up[i][j]].nh > shang) continue;
      all.insert(a[up[i][j]].ti);
      if (adh[i]) {
        long long t =
            a[up[i][j]].ti + max(0ll, ((shang - a[up[i][j]].nh)) / adh[i]);
        if (j + 1 != up[i].size() && t >= a[up[i][j + 1]].ti) {
          all.insert(a[up[i][j + 1]].ti);
        } else {
          all.insert(t + 1);
        }
      } else {
        if (j + 1 != up[i].size()) all.insert(a[up[i][j + 1]].ti);
      }
    }
  }
  for (__typeof((all).begin()) it = (all).begin(); it != (all).end(); it++) {
    mp[*it] = ++ccc;
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j < up[i].size(); j++) {
      if (a[up[i][j]].nh > shang) continue;
      cnt[mp[a[up[i][j]].ti]]++;
      if (adh[i]) {
        long long t =
            a[up[i][j]].ti + max(0ll, ((shang - a[up[i][j]].nh)) / adh[i]);
        if (j + 1 != up[i].size() && t >= a[up[i][j + 1]].ti) {
          cnt[mp[a[up[i][j + 1]].ti]]--;
        } else {
          cnt[mp[t + 1]]--;
        }
      } else {
        if (j + 1 != up[i].size()) cnt[mp[a[up[i][j + 1]].ti]]--;
      }
    }
  }
  mp[1e18] = ++ccc;
  long long lst = 0;
  for (__typeof((mp).begin()) it = (mp).begin(); it != (mp).end(); it++) {
    ans = max(ans, lst * (gt + adgt * it->first - adgt));
    lst += cnt[it->second];
  }
  if (lst && adgt)
    cout << -1;
  else
    cout << ans;
  return 0;
}
