#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
inline long long add(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline long long sub(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline long long mul(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
long long mypow(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 1LL;
  long long _ret = mypow(mul(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = mul(_ret, _a, _mod);
  return _ret;
}
long long mymul(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 0LL;
  long long _ret = mymul(add(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = add(_ret, _a, _mod);
  return _ret;
}
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
void sleep(double sec = 1021) {
  clock_t s = clock();
  while (clock() - s < CLOCKS_PER_SEC * sec)
    ;
}
int __ = 1, _cs;
struct I {
  long long ps, s;
  I() { ps = s = 0; }
};
inline I operator+(const I& lhs, const I& rhs) {
  I ret;
  ret.ps = min(lhs.ps, lhs.s + rhs.ps);
  ret.s = lhs.s + rhs.s;
  return ret;
}
struct Nd {
  I i;
  Nd *tl, *tr;
  Nd() {
    i = I();
    tl = tr = NULL;
  }
};
const int inf = 1000000000;
inline I Item(Nd* now) { return now ? now->i : I(); }
struct SegT {
  long long a[2];
  Nd* root;
  void init(long long ad, long long sb) {
    a[0] = -sb;
    a[1] = ad;
    root = new Nd();
  }
  void modify(Nd* now, int l, int r, int p, long long vl) {
    if (l == r) {
      now->i.ps = min(0LL, vl);
      now->i.s = vl;
      return;
    }
    if (p <= ((l + r) >> 1)) {
      if (!now->tl) now->tl = new Nd();
      modify(now->tl, l, ((l + r) >> 1), p, vl);
    } else {
      if (!now->tr) now->tr = new Nd();
      modify(now->tr, ((l + r) >> 1) + 1, r, p, vl);
    }
    now->i = Item(now->tl) + Item(now->tr);
  }
  void modify(int p, int who) { modify(root, 0, inf, p, a[who]); }
  I query(Nd* now, int l, int r, int ql, int qr) {
    if (!now or r < ql or l > qr or ql > qr) return I();
    if (ql <= l and r <= qr) return now->i;
    return query(now->tl, l, ((l + r) >> 1), ql, qr) +
           query(now->tr, ((l + r) >> 1) + 1, r, ql, qr);
  }
  I query(int ql, int qr) {
    ql = max(ql, 0);
    qr = min(qr, inf);
    return query(root, 0, inf, ql, qr);
  }
} t1, t2;
void build() {}
int n, a, b, c, d, start, len;
vector<int> cand;
void init() {
  n = getint();
  a = getint();
  b = getint();
  c = getint();
  d = getint();
  start = getint();
  len = getint();
  t1.init(a, b);
  t2.init(c, d);
  cand.push_back(0);
  for (int i = 0; i < n; i++) {
    int ti = getint();
    int qi = getint();
    t1.modify(ti, qi);
    t2.modify(ti, qi);
    cand.push_back(ti);
    cand.push_back(ti + 1);
    if (ti >= len - 1) cand.push_back(ti - len + 1);
    if (ti >= len) cand.push_back(ti - len);
  }
}
void solve() {
  sort(cand.begin(), cand.end());
  cand.resize(unique(cand.begin(), cand.end()) - cand.begin());
  for (size_t i = 0; i < cand.size(); i++) {
    int tt = cand[i];
    I fst = t1.query(0, tt - 1);
    I snd = t2.query(tt, tt + len - 1);
    if (start + fst.ps >= 0 and start + fst.s + snd.ps >= 0) {
      printf("%d\n", tt);
      exit(0);
    }
  }
  puts("-1");
}
int main() {
  build();
  while (__--) {
    init();
    solve();
  }
}
