#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, d, start, len;
vector<long long> normalSum, specialSum;
class Event {
 public:
  int time;
  int type;
  Event(int time, int type) {
    this->time = time;
    this->type = type;
  }
};
vector<Event> events;
deque<int> vals;
int main() {
  cin >> n >> a >> b >> c >> d >> start >> len;
  events.push_back(Event(0, -1));
  for (int i = 0; i < n; i++) {
    int time, type;
    cin >> time >> type;
    if (events.empty() || events.back().time != time) {
      events.push_back(Event(time, type));
    } else {
      events.back().type = type;
    }
    events.push_back(Event(time + 1, -1));
  }
  for (int i = 0; i < events.size(); i++) {
    normalSum.push_back((events[i].type == 1 ? a : -b) *
                            (events[i].type != -1) +
                        (normalSum.empty() ? start : normalSum.back()));
    specialSum.push_back((events[i].type == 1 ? c : -d) *
                             (events[i].type != -1) +
                         (specialSum.empty() ? start : specialSum.back()));
  }
  long long prevVal = start;
  for (int i = 0; i < events.size(); i++) {
    if (prevVal < 0) continue;
    while (vals.empty() ||
           (vals.back() + 1 < events.size() &&
            events[vals.back() + 1].time < events[i].time + len)) {
      if (vals.empty()) {
        vals.push_back(i);
      } else {
        int nextVal = vals.back() + 1;
        while (!vals.empty() && specialSum[vals.back()] >= specialSum[nextVal])
          vals.pop_back();
        vals.push_back(nextVal);
      }
    }
    while (vals.front() < i) vals.pop_front();
    if (specialSum[vals.front()] -
            (i == 0 ? 0 : (specialSum[i - 1] - normalSum[i - 1])) >=
        0) {
      cout << events[i].time << endl;
      return 0;
    }
    prevVal = normalSum[i];
  }
  cout << -1 << endl;
}
