#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
}
int n, a, b, c, d, start, len;
pair<int, int> q[300007];
long long sum[300007], tot[300007];
int main() {
  read(n);
  read(a);
  read(b);
  read(c);
  read(d);
  read(start);
  read(len);
  for (int i = 1; i <= n; i++) {
    read(q[i].first);
    read(q[i].second);
  }
  q[0] = make_pair(-1, -1);
  sum[0] = start;
  tot[0] = start;
  for (int i = 1; i <= n; i++) {
    if (q[i].second == 0) {
      sum[i] = sum[i - 1] - b;
      tot[i] = tot[i - 1] - d;
    } else {
      sum[i] = sum[i - 1] + a;
      tot[i] = tot[i - 1] + c;
    }
  }
  multiset<long long> s;
  int pos = 1;
  for (int i = 0; i <= n; i++) {
    if (sum[i] < 0) {
      writeln(-1);
      return 0;
    }
    if (i) s.erase(s.find(tot[i]));
    while (pos <= n && q[pos].first - (q[i].first + 1) < len)
      s.insert(tot[pos++]);
    if (s.size() == 0) {
      writeln(q[i].first + 1);
      return 0;
    }
    long long val = *s.begin();
    val += sum[i] - tot[i];
    if (val >= 0) {
      writeln(q[i].first + 1);
      return 0;
    }
  }
}
