#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5 + 9;
int vec[MAX_N];
int res[MAX_N];
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);
  for (int i = 0; i < N; i++) scanf("%d%d", &vec[i], &res[i]);
  int pos = 0;
  long long int s = 0, x = start;
  long long int minn = 0;
  for (int i = 0; i < N; i++) {
    while (pos < N && vec[pos] - vec[i] <= len) {
      s += res[pos] ? c : -d;
      minn = min(s, minn);
      pos++;
    }
    if (x + minn >= 0) {
      if (i == 0)
        printf("0\n");
      else
        printf("%d\n", vec[i - 1] + 1);
      return 0;
    }
    s -= res[i] ? c : -d;
    minn -= res[i] ? c : -d;
    x += res[i] ? a : -b;
    if (x < 0) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%d\n", N + 1);
  return 0;
}
