#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> events[300010];
int main() {
  long long n, a, b, c, d, start, len;
  cin >> n >> a >> b >> c >> d >> start >> len;
  for (long long i = 0; i < n; ++i) {
    cin >> events[i].first >> events[i].second;
  }
  events[n] = pair<long long, long long>(2000000001, -1);
  long long pos = 0;
  bool isGood = 0;
  long long anti = 0, antf = 0;
  long long e = start;
  long long ai, bi, af, bf;
  bi = ai = bf = af = 0;
  long long fin = 0;
  long long tem = start;
  long long rank = start;
  while (pos <= n && !isGood) {
    if (e < 0) {
      if (events[pos].second)
        ai++;
      else
        bi++;
      anti = events[pos].first;
      e -= (c - a) * ai;
      e += (d - b) * bi;
      rank += a * ai;
      rank -= b * bi;
      if (rank < 0) break;
      if (pos >= fin) {
        e += c * ai;
        e -= d * bi;
        ++fin;
      }
      ai = bi = 0;
      pos++;
    } else {
      if (events[fin].first > anti + len) {
        if (e >= 0) {
          isGood = true;
          break;
        }
      } else {
        if (events[fin].second)
          af++;
        else
          bf++;
        antf = events[fin].first;
        e += c * af;
        e -= d * bf;
        af = bf = 0;
        fin++;
        tem += a * af;
        tem -= b * bf;
        if (tem < 0) break;
      }
    }
  }
  if (isGood && pos == 0) anti = -1;
  if (isGood)
    cout << anti + 1 << "\n";
  else
    cout << -1 << "\n";
  return 0;
}
