#include <bits/stdc++.h>
using namespace std;
const bool dbg = false;
class Enemy {
 public:
  long long maxHealth, startHealth, regen;
  priority_queue<long long, vector<long long>,
                 function<bool(long long &a, long long &b)>>
      eventTimes;
  Enemy(long long maxHealth, long long startHealth, long long regen)
      : maxHealth(maxHealth),
        startHealth(startHealth),
        regen(regen),
        eventTimes([](long long &a, long long &b) { return a >= b; }) {}
  long long getVunerabilityTimeForDMG(long long damage);
};
long long Enemy::getVunerabilityTimeForDMG(long long damage) {
  return (damage - startHealth) / regen;
}
class Event {
 public:
  long long time, enemyID, health;
  long long type;
  static function<bool(Event &a, Event &b)> cmp;
  Event(long long time, long long enemy) : time(time), enemyID(enemy) {
    type = dropOutType;
  }
  Event(long long time, long long enemy, long long health)
      : time(time), enemyID(enemy), health(health) {
    type = normaType;
  }
  static const long long normaType = 0;
  static const long long dropOutType = 1;
};
function<bool(Event &a, Event &b)> Event::cmp = [](Event &a, Event &b) {
  if (a.time > b.time) {
    return true;
  }
  if (a.time == b.time) {
    return a.type > b.type;
  }
  return false;
};
class Solution {
 public:
  vector<Enemy> enemies;
  long long n, m;
  long long bounty, increase, damage;
  bool currentEnemies[(int)(1e5 + 1)];
  long long currentEnemiesCount = 0;
  long long currentTime;
  priority_queue<Event, vector<Event>, decltype(Event::cmp)> events;
  long long currentMaxKill;
  Solution() : events(Event::cmp) {
    currentTime = 0;
    currentMaxKill = 0;
    currentEnemiesCount = 0;
    readData();
  }
  void readData();
  long long findMaxKill();
  void updateEmeny(long long enemyID);
  void handleUpdateEvent(long long time, long long enemyID,
                         long long newHealth);
  void handleDropOutEvent(long long enemyID);
  void checkCurrentStatus();
  void initCurrentEnemies();
  void insertEnemy(long long enemyID);
  void eraseEnemy(long long enemyID);
};
void Solution::readData() {
  cin >> n >> m;
  cin >> bounty >> increase >> damage;
  long long maxHealth, startHealth, regen;
  for (int i = 0; i < n; i++) {
    cin >> maxHealth >> startHealth >> regen;
    enemies.emplace_back(maxHealth, startHealth, regen);
    currentEnemies[i] = false;
  }
  long long time, enemy, health;
  for (int i = 0; i < m; i++) {
    cin >> time >> enemy >> health;
    enemy--;
    events.emplace(time, enemy, health);
    enemies[enemy].eventTimes.push(time);
  }
}
long long Solution::findMaxKill() {
  initCurrentEnemies();
  checkCurrentStatus();
  while (!events.empty()) {
    Event e = events.top();
    events.pop();
    currentTime = e.time;
    if (e.type == Event::normaType) {
      handleUpdateEvent(e.time, e.enemyID, e.health);
    } else {
      checkCurrentStatus();
      handleDropOutEvent(e.enemyID);
    }
  }
  if (currentEnemiesCount > 0 && increase > 0) {
    return -1;
  }
  return currentMaxKill;
}
void Solution::initCurrentEnemies() {
  for (int i = 0; i < enemies.size(); i++) {
    updateEmeny(i);
  }
}
void Solution::updateEmeny(long long enemyID) {
  long long i = enemyID;
  auto nextEventTime = (long long)1e18;
  if (!enemies[i].eventTimes.empty()) {
    nextEventTime = enemies[i].eventTimes.top();
    enemies[i].eventTimes.pop();
  }
  if (enemies[i].startHealth <= damage && enemies[i].maxHealth > damage &&
      enemies[i].regen > 0) {
    long long dropOutTime;
    dropOutTime =
        min(enemies[i].getVunerabilityTimeForDMG(damage) + currentTime,
            nextEventTime - 1);
    events.emplace(dropOutTime, i);
    insertEnemy(i);
    if (dbg)
      if (dbg)
        cout << "insert " << enemyID << " dropOutTime " << dropOutTime << " "
             << nextEventTime - 1 << " "
             << enemies[i].getVunerabilityTimeForDMG(damage) << endl;
  } else if (enemies[i].maxHealth <= damage ||
             (enemies[i].startHealth <= damage && enemies[i].regen == 0)) {
    insertEnemy(i);
    if (nextEventTime != 1e18) {
      events.emplace(nextEventTime - 1, i);
    }
  } else {
    eraseEnemy(i);
  }
}
void Solution::checkCurrentStatus() {
  currentMaxKill = max(currentMaxKill, (long long)currentEnemiesCount *
                                           (bounty + currentTime * increase));
  if (dbg)
    cout << "current time: " << currentTime
         << " current maxKill: " << currentMaxKill << " size "
         << currentEnemiesCount << endl;
}
void Solution::handleDropOutEvent(long long enemyID) {
  if (dbg) cout << "drop id: " << enemyID << " time: " << currentTime << endl;
  eraseEnemy(enemyID);
}
void Solution::handleUpdateEvent(long long time, long long enemyID,
                                 long long newHealth) {
  if (dbg) cout << "update id: " << enemyID << " time: " << currentTime << endl;
  enemies[enemyID].startHealth = newHealth;
  updateEmeny(enemyID);
}
void Solution::eraseEnemy(long long enemyID) {
  if (currentEnemies[enemyID]) {
    currentEnemiesCount--;
  }
  currentEnemies[enemyID] = false;
}
void Solution::insertEnemy(long long enemyID) {
  if (!currentEnemies[enemyID]) {
    currentEnemiesCount++;
  }
  currentEnemies[enemyID] = true;
}
int main() {
  ios_base::sync_with_stdio(false);
  Solution solution;
  cout << solution.findMaxKill() << endl;
  return 0;
}
