#include <bits/stdc++.h>
using namespace std;
int n, m;
long long bounty, increase, damage;
long long maxHealth[100100];
long long regen[100100];
vector<pair<long long, long long> > sweep;
vector<pair<long long, long long> > update[100100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  cin >> bounty >> increase >> damage;
  for (int i = 1; i <= n; i++) {
    long long startHealth;
    cin >> maxHealth[i] >> startHealth >> regen[i];
    update[i].push_back(make_pair(0, startHealth));
  }
  for (int i = 0; i < m; i++) {
    long long tim, enemy, health;
    cin >> tim >> enemy >> health;
    update[enemy].push_back(make_pair(tim, health));
  }
  for (int i = 1; i <= n; i++) {
    sort(update[i].begin(), update[i].end());
    for (int j = 0; j < update[i].size(); j++) {
      long long startT = update[i][j].first;
      long long startP = update[i][j].second;
      if (startP > damage) continue;
      sweep.push_back(make_pair(startT, 1));
      sweep.push_back(make_pair(startT + 1, 0));
      if (maxHealth[i] <= damage) break;
      long long willEnd = 1e15;
      if (regen[i] != 0) willEnd = startT + (damage - startP) / regen[i] + 1;
      if (j + 1 < update[i].size() && update[i][j + 1].first < willEnd) {
        sweep.push_back(make_pair(update[i][j + 1].first, -1));
        sweep.push_back(make_pair(update[i][j + 1].first - 1, 0));
      } else if (willEnd < 1e15) {
        sweep.push_back(make_pair(willEnd, -1));
        sweep.push_back(make_pair(willEnd - 1, 0));
      }
    }
  }
  sweep.push_back(make_pair(1e15, 0));
  sort(sweep.begin(), sweep.end());
  long long ans = 0;
  long long cnt = 0;
  for (int i = 0; i < sweep.size(); i++) {
    cnt += sweep[i].second;
    if (i + 1 < sweep.size() && sweep[i].first == sweep[i + 1].first) continue;
    ans = max(ans, cnt * (bounty + sweep[i].first * increase));
  }
  if (cnt && increase)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
