#include <bits/stdc++.h>
const int MAXN = 3000001;
const long long INF = 1ll << 50;
struct Event {
  int t, q;
} e[MAXN];
int n, l, tot, p[MAXN];
std::vector<int> g[MAXN];
long long a, b, c, d, s, sum[MAXN][2], zmin[MAXN], hmin[MAXN], delta;
std::priority_queue<std::pair<long long, int>,
                    std::vector<std::pair<long long, int>>,
                    std::greater<std::pair<long long, int>>>
    heap;
int main() {
  std::cin >> n >> a >> b >> c >> d >> s >> l;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &e[i].t, &e[i].q);
    p[++tot] = e[i].t;
    p[++tot] = e[i].t + 1;
    p[++tot] = std::max(0, e[i].t - l + 1);
  }
  p[++tot] = 0;
  std::sort(p + 1, p + tot + 1);
  tot = std::unique(p + 1, p + tot + 1) - p - 1;
  for (int i = 1; i <= n; i++) {
    e[i].t = std::lower_bound(p + 1, p + tot + 1, e[i].t) - p;
    g[e[i].t].push_back(e[i].q);
  }
  for (int i = 1; i <= tot; i++) {
    sum[i][0] = sum[i - 1][0];
    sum[i][1] = sum[i - 1][1];
    for (auto &e : g[i]) {
      sum[i][e]++;
    }
  }
  zmin[0] = INF;
  for (int i = 1; i <= tot; i++) {
    zmin[i] = std::min(zmin[i - 1], sum[i][1] * a - sum[i][0] * b);
  }
  for (int i = 1, j = 1; i <= tot; i++) {
    while (j <= tot && p[j] < p[i] + l) {
      heap.push(std::make_pair((sum[i - 1][1] * a - sum[i - 1][0] * b) +
                                   ((sum[j][1] - sum[i - 1][1]) * c -
                                    (sum[j][0] - sum[i - 1][0]) * d) -
                                   delta,
                               j));
      j++;
    }
    long long answer = INF;
    answer = std::min(zmin[i - 1], answer);
    while (!heap.empty() && heap.top().second < i) {
      heap.pop();
    }
    if (!heap.empty()) {
      answer = std::min(answer, heap.top().first + delta);
    }
    if (answer + s >= 0) {
      printf("%d\n", p[i]);
      return 0;
    }
    delta +=
        -((sum[i][1] - sum[i - 1][1]) * c - (sum[i][0] - sum[i - 1][0]) * d) +
        ((sum[i][1] - sum[i - 1][1]) * a - (sum[i][0] - sum[i - 1][0]) * b);
  }
  puts("-1");
  return 0;
}
