#include <bits/stdc++.h>
using namespace std;
void JIZZ() {
  cout << "-1" << endl;
  exit(0);
}
const long double PI = 3.14159265358979323846264338327950288;
const long double eps = 1e-13;
const long long mod = 1e9 + 7;
long long a, b, c, d;
struct event {
  long long t, type, rating;
};
event deq[300005];
long long pre, exitpre;
int front = 0, back = -1;
deque<int> dq;
void addShowEvent(event e) {
  ;
  ;
  deq[++back] = e;
  deq[back].rating = (deq[back].type ? c : -d);
  deq[back].rating += pre;
  pre = deq[back].rating;
  while (dq.size() && deq[dq.back()].rating >= deq[back].rating) dq.pop_back();
  dq.push_back(back);
}
bool checkOK(long long now) {
  return now + deq[dq.front()].rating - exitpre >= 0;
}
event getFirst() {
  if (front > back) return {-1, -1};
  return deq[front];
}
void eraseShowEvent() {
  ;
  ;
  exitpre += (deq[front].type ? c : -d);
  ;
  ;
  ++front;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long long start, len;
  cin >> n >> a >> b >> c >> d >> start >> len;
  deque<event> es;
  for (int i = 0; i < n; ++i) {
    long long t, tt;
    cin >> t >> tt;
    es.push_back({t, tt});
  }
  long long now = start, nowT = 0;
  while (es.size() && es.front().t < nowT + len) {
    addShowEvent(es.front());
    es.pop_front();
  }
  if (checkOK(now)) {
    cout << nowT << endl;
    exit(0);
  }
  while (true) {
    event before = getFirst();
    if (before.type == -1) {
      if (es.empty()) break;
      before = es.front();
    }
    nowT = before.t;
    while (es.size() && es.front().t < nowT + len) {
      addShowEvent(es.front());
      es.pop_front();
    }
    if (checkOK(now)) {
      cout << nowT << endl;
      exit(0);
    }
    eraseShowEvent();
    now += before.type ? a : -b;
    if (now < 0) JIZZ();
    ++nowT;
    while (es.size() && es.front().t < nowT + len) {
      addShowEvent(es.front());
      es.pop_front();
    }
    if (checkOK(now)) {
      cout << nowT << endl;
      exit(0);
    }
  };
  ;
  cout << -1 << endl;
}
