#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e6 + 5;
const long long INF = 1e18;
long long a, b, c, d, n, st, len, bb[MAXN], t[MAXN], num[2][MAXN], cnt,
    pre[MAXN], pre2[MAXN];
long long MAX[MAXN << 2];
map<long long, long long> mp;
void clearit() {
  memset(MAX, 0, sizeof(MAX));
  cnt = 0;
  memset(num, 0, sizeof(num));
  memset(pre, 0, sizeof(pre));
  mp.clear();
}
void initpre() {
  for (long long i = 1; i <= cnt; i++) {
    pre[i] = num[0][i] * d - num[1][i] * c;
    pre2[i] = min(pre2[i - 1], -num[0][i] * b + num[1][i] * a);
  }
}
void PushUP(int rt) { MAX[rt] = max(MAX[rt << 1], MAX[rt << 1 | 1]); }
void build(int l, int r, int rt) {
  if (l == r) {
    MAX[rt] = pre[l];
    return;
  }
  int m = (l + r) >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
  PushUP(rt);
}
long long query(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) {
    return MAX[rt];
  }
  int m = (l + r) >> 1;
  long long ret = -1;
  if (L <= m) ret = max(ret, query(L, R, l, m, rt << 1));
  if (R > m) ret = max(ret, query(L, R, m + 1, r, rt << 1 | 1));
  return ret;
}
bool legal(long long x) { return x >= 0; }
long long Hash(long long x) {
  return lower_bound(bb + 1, bb + 1 + cnt, x) - bb;
}
void init() {
  for (long long i = 1; i <= n; i++) {
    bb[++cnt] = t[i];
    if (legal(t[i] - len + 1)) {
      bb[++cnt] = t[i] - len + 1;
    }
    bb[++cnt] = t[i] + 1;
  }
  bb[++cnt] = 0;
  sort(bb + 1, bb + 1 + cnt);
  cnt = unique(bb + 1, bb + 1 + cnt) - bb - 1;
  long long cnt1 = cnt;
  for (long long i = 1; i <= cnt; i++) {
    bb[++cnt1] = bb[i] + len - 1;
  }
  sort(bb + 1, bb + 1 + cnt1);
  cnt = unique(bb + 1, bb + 1 + cnt1) - bb - 1;
}
void getnum() {
  for (long long i = 1; i <= cnt; i++) {
    num[0][i] = num[0][i - 1];
    num[1][i] = num[1][i - 1];
    long long nw = bb[i];
    if (mp.count(nw)) {
      num[mp[nw]][i]++;
    }
  }
}
bool judge(long long t) {
  long long num0 = num[0][t - 1];
  long long num1 = num[1][t - 1];
  long long p = -num0 * b + num1 * a + st;
  if (pre2[t - 1] + st >= 0) {
    long long nex = Hash(bb[t] + len - 1);
    long long det = query(t, nex, 1, cnt, 1);
    det += -(num0 * d - num1 * c);
    if (p - det >= 0) {
      return true;
    }
  }
  return false;
}
void solve() {
  init();
  getnum();
  initpre();
  build(1, cnt, 1);
  for (long long i = 1; i <= cnt; i++) {
    if (judge(i)) {
      printf("%lld\n", bb[i]);
      return;
    }
  }
  printf("-1\n");
}
int main() {
  while (~scanf("%lld %lld %lld %lld %lld %lld %lld", &n, &a, &b, &c, &d, &st,
                &len)) {
    for (long long i = 1; i <= n; i++) {
      long long tem;
      scanf("%lld", &t[i]);
      scanf("%lld", &tem);
      mp[t[i]] = tem;
    }
    solve();
    clearit();
  }
}
