#include <bits/stdc++.h>
using namespace std;
struct node {
  int q, t;
};
node pos[300005];
int main(void) {
  long long n, a, b, c, d, st, len;
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d", &n, &a, &b, &c, &d, &st, &len);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &pos[i].q, &pos[i].t);
  }
  long long sum = st, ans = 0, minn = 0;
  int e = 1;
  pos[0].q = -1;
  for (int s = 1; s <= n; s++) {
    while (e <= n && pos[e].q - pos[s].q <= len) {
      if (pos[e].t == 1) {
        ans += c;
      } else {
        ans -= d;
      }
      minn = min(minn, ans);
      e++;
    }
    if (sum + minn >= 0) {
      printf("%d\n", pos[s - 1].q + 1);
      return 0;
    }
    if (pos[s].t == 1) {
      ans -= c;
      minn -= c;
      sum += a;
    } else {
      ans += d;
      minn += d;
      sum -= b;
    }
    if (sum < 0) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%d\n", pos[n].q + 1);
  return 0;
}
