#include <bits/stdc++.h>
using namespace std;
tuple<long long, long long, long long> tp[200001];
long long mx[100001];
long long re[100001];
bool vis[100001];
set<long long> up[100001];
map<long long, long long> cnt;
int main() {
  long long n, m;
  long long boun, inc, dema;
  scanf("%lld%lld%lld%lld%lld", &n, &m, &boun, &inc, &dema);
  for (long long i = 0; i < n; ++i) {
    long long s;
    scanf("%lld%lld%lld", mx + i, &s, re + i);
    if (mx[i] <= dema && inc != 0) {
      printf("-1");
      return 0;
    }
    tp[i] = make_tuple(0, i, s);
  }
  for (long long i = 0; i < m; ++i) {
    long long time, enem, hel;
    scanf("%lld%lld%lld", &time, &enem, &hel);
    enem--;
    tp[n + i] = make_tuple(time, enem, hel);
    up[enem].insert(time);
  }
  sort(tp + 0, tp + n + m);
  for (long long i = 0; i < n + m; ++i) {
    long long time, enem, hel;
    tie(time, enem, hel) = tp[i];
    if (dema >= hel) {
      if (!vis[enem]) {
        vis[enem] = true;
        cnt[time]++;
      }
      if (vis[enem]) {
        if (re[enem] != 0) {
          long long how = time + ((dema - hel) / re[enem]) + 1;
          if (up[enem].upper_bound(how) == up[enem].upper_bound(time) &&
              mx[enem] > dema) {
            cnt[how]--;
            cnt[how - 1] += 0;
            vis[enem] = false;
          }
        } else {
          if (inc != 0 && up[enem].upper_bound(time) == up[enem].end()) {
            printf("-1");
            return 0;
          }
        }
      }
    } else {
      if (vis[enem]) {
        cnt[time]--;
        cnt[time - 1] += 0;
        vis[enem] = false;
      }
    }
  }
  long long ans = 0, sum = 0;
  for (auto p : cnt) {
    long long a, b;
    tie(a, b) = p;
    sum += b;
    ans = max(ans, sum * (boun + inc * a));
  }
  printf("%lld\n", ans);
  return 0;
}
