#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void amax(X& x, const Y& y) {
  if (x < y) x = y;
}
template <class X, class Y>
void amin(X& x, const Y& y) {
  if (x > y) x = y;
}
const int INF = 1e9 + 10;
const long long INFL = 1e18 + 10;
const int MAX = 3e5 + 10;
int n, a, b, c, d, len;
long long start;
pair<int, int> q[MAX];
long long sums[MAX];
long long fwt[MAX];
void update(int p, long long value) {
  for (; p <= n; p += p & -p) amin(fwt[p], value);
}
long long query(int l, int r) {
  long long res = INFL;
  while (r >= l) {
    if (r - (r & -r) >= l) {
      amin(res, fwt[r]);
      r -= r & -r;
    } else {
      amin(res, sums[r--]);
    }
  }
  return res;
}
int findRight(int p) {
  int l = 1, r = n, i = (l + r) / 2;
  while (l != i && i != r) {
    if (q[i].first <= p)
      l = i;
    else
      r = i;
    i = (l + r) / 2;
  }
  for (int i = r; i >= l; i--)
    if (q[i].first <= p) return i;
  return -1;
}
void process() {
  cin >> n >> a >> b >> c >> d >> start >> len;
  for (int i = 1; i <= n; i++) cin >> q[i].first >> q[i].second;
  q[0].first = -1;
  for (int i = 1; i <= n; i++) {
    if (q[i].second == 0)
      sums[i] = sums[i - 1] - d;
    else
      sums[i] = sums[i - 1] + c;
  }
  for (int i = 1; i <= n; i++) fwt[i] = INFL;
  for (int i = 1; i <= n; i++) update(i, sums[i]);
  for (int i = 1; i <= n; i++) {
    if (start < 0) {
      cout << -1;
      return;
    }
    int p = q[i - 1].first + 1;
    int last = findRight(p + len - 1);
    long long vmin = query(i, last) - sums[i - 1];
    if (last < i || start + vmin >= 0) {
      cout << p;
      return;
    }
    if (q[i].second == 0)
      start -= b;
    else
      start += a;
  }
  if (start < 0)
    cout << -1;
  else
    cout << q[n].first + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  process();
}
