#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 10;
const int inf = 0x3f3f3f3f;
int main() {
  int n, a, b, c, d, start, len;
  cin >> n >> a >> b >> c >> d >> start >> len;
  vector<int> t(n), q(n);
  for (int i = 0; i < n; i++) scanf("%d%d", &t[i], &q[i]);
  int j = 0;
  long long df = 0, mn = 0, ac = start;
  vector<int> T;
  T.push_back(-1);
  for (int i = 0; i < n; i++) T.push_back(t[i]);
  for (int i = 0; i < n; i++) {
    while (j < n && t[j] - t[i] < len) {
      df += (q[j] ? c : -d);
      mn = min(mn, df);
      j++;
    }
    if (ac + mn >= 0) {
      cout << T[i] + 1 << endl;
      return 0;
    }
    df -= (q[i] ? c : -d);
    mn -= (q[i] ? c : -d);
    ac += (q[i] ? a : -b);
    if (ac < 0) {
      puts("-1");
      return 0;
    }
  }
  cout << T[n] + 1 << endl;
}
