#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, d, start, len;
long long t[300010], q[300010];
int main() {
  scanf("%lld%lld%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d, &start, &len);
  int i, j;
  for (i = 1; i <= n; i++) scanf("%lld%lld", &t[i], &q[i]);
  long long x = start, y = 0, miny = 0;
  t[0] = -1;
  j = 1;
  for (i = 1; i <= n; i++) {
    while (t[j] - t[i] < len && j <= n) {
      y += q[j] ? c : -d;
      miny = min(miny, y);
      j++;
    }
    if (x + miny >= 0) {
      printf("%lld\n", t[i - 1] + 1);
      return 0;
    }
    y -= q[i] ? c : -d;
    miny -= q[i] ? c : -d;
    x += q[i] ? a : -b;
    if (x < 0) {
      puts("-1");
      return 0;
    }
  }
  printf("%lld\n", t[n] + 1);
  return 0;
}
