#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300050;
long long n, a, b, c, d, start, len;
int t[MAXN], op[MAXN];
long long w[MAXN];
int main() {
  cin >> n >> a >> b >> c >> d >> start >> len;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &t[i], &op[i]);
  }
  int id = 1;
  long long delta = 0, now = start, low = 0x3f3f3f3f;
  t[0] = -1;
  for (int i = 1; i <= n; i++) {
    while (id <= n && t[id] - t[i] <= len) {
      delta += op[id] ? c : -d;
      low = min(low, delta);
      id++;
    }
    if (low + now >= 0) {
      cout << t[i - 1] + 1 << endl;
      return 0;
    }
    delta -= op[i] ? c : -d;
    low -= op[i] ? c : -d;
    now += op[i] ? a : -b;
    if (now < 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << t[n] + 1 << endl;
  return 0;
}
