#include <bits/stdc++.h>
using namespace std;
int const N = 1 << 18;
int const M = 1 << 18;
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b, c, d;
  int len;
  long long start;
  cin >> n >> a >> b >> c >> d;
  cin >> start >> len;
  std::vector<std::pair<int, int> > q(1 + n);
  for (int i = 1; i <= n; ++i) cin >> q[i].first >> q[i].second;
  q[0] = std::pair<int, int>(-1, -1);
  std::vector<long long> pref1(1 + n), pref2(1 + n);
  pref1[0] = start;
  pref2[0] = start;
  for (int i = 1; i <= n; ++i) {
    if (q[i].second == 0) {
      pref1[i] = pref1[i - 1] - b;
      pref2[i] = pref2[i - 1] - d;
    } else {
      pref1[i] = pref1[i - 1] + a;
      pref2[i] = pref2[i - 1] + c;
    }
  }
  multiset<long long> ss;
  int r = 1;
  for (int i = 0; i <= n; ++i) {
    if (pref1[i] < 0) {
      cout << -1 << endl;
      return 0;
    }
    if (i) ss.erase(ss.find(pref2[i]));
    while (r <= n && q[r].first - (q[i].first + 1) < len) {
      ss.insert(pref2[r++]);
    }
    if (ss.empty()) {
      cout << q[i].first + 1 << endl;
      return 0;
    }
    long long ss_min = *ss.begin();
    ss_min += pref1[i] - pref2[i];
    if (ss_min >= 0) {
      cout << q[i].first + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
