#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, pair<long long, long long> > > vt;
vector<pair<int, int> > v;
int main() {
  int n, a, b, c, d, start, len;
  scanf("%d%d%d%d%d%d%d", &n, &a, &b, &c, &d, &start, &len);
  int i, t, q;
  v.push_back({-1, -1});
  for (i = 0; i < n; i++) {
    scanf("%d%d", &t, &q);
    v.push_back({t, q});
  }
  vector<long long> sum, ats;
  sum.push_back(start);
  ats.push_back(start);
  for (i = 1; i <= n; i++) {
    if (v[i].second == 0) {
      sum.push_back(sum[i - 1] - b);
      ats.push_back(ats[i - 1] - d);
    } else {
      sum.push_back(sum[i - 1] + a);
      ats.push_back(ats[i - 1] + c);
    }
  }
  multiset<long long> ms;
  int j = 1;
  for (i = 0; i < sum.size(); i++) {
    if (sum[i] < 0) {
      printf("-1");
      return 0;
    }
    if (i != 0) {
      ms.erase(ms.find(ats[i]));
    }
    while (j < sum.size() && v[j].first - v[i].first - 1 < len) {
      ms.insert(ats[j++]);
    }
    if (ms.size() == 0 || (*ms.begin() + sum[i] - ats[i] >= 0)) {
      printf("%d", v[i].first + 1);
      return 0;
    }
  }
  return 0;
}
