#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void Print() { cout << endl; }
template <typename T1, typename... T>
void Print(const T1 &t1, const T &...t) {
  cout << t1 << " ";
  Print(t...);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class Iterator>
ostream &output_cantainer(ostream &os, Iterator first, Iterator last,
                          bool space = true) {
  if (space) {
    for (Iterator it = first; it != last; it++) {
      os << (*it) << ' ';
    }
    os << endl;
  } else
    for (Iterator it = first; it != last; it++) {
      os << (*it) << endl;
    }
  return os;
}
const int N = 3e5 + 7;
struct E {
  int t, q;
} es[N];
int n, a, b, c, d, ll, s;
LL csum[N], msum[N], pres, prems;
int solve() {
  if (es[1].t >= ll) return 0;
  for (int i = 1; i <= n; i++) {
    csum[i] = csum[i - 1];
    csum[i] += (es[i].q) ? c : -d;
    msum[i] = min(msum[i - 1], csum[i]);
  }
  int l = 1, r = 1, t = 0;
  for (; r <= n && es[r].t < ll; r++) {
  }
  if (s + msum[r - 1] > 0) return 0;
  while (l <= n) {
    int nt = es[l].t + 1;
    if (r <= n) nt = min(es[r].t + 1 - ll, nt);
    if (es[l].t + 1 == nt) {
      pres += (es[l].q) ? a : -b;
      prems = min(pres, prems);
      l++;
    }
    if (r <= n && es[r].t + 1 - ll == nt) {
      r++;
    }
    if (s + prems >= 0 && s + pres + msum[r - 1] - csum[l - 1] >= 0) return nt;
  }
  return -1;
}
int main() {
  scanf("%d%d%d%d%d%d%d", &n, &a, &b, &c, &d, &s, &ll);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &es[i].t, &es[i].q);
  }
  printf("%d\n", solve());
}
