#include <bits/stdc++.h>
using namespace std;
struct gg {
  int num, t;
};
gg que[300500];
bool cmp(gg aa, gg bb) { return aa.t < bb.t; }
long long a, b, c, d, rate, len, start, ans, minn;
int main() {
  int i, n, node;
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d", &n, &a, &b, &c, &d, &start,
        &len);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &que[i].t, &que[i].num);
  }
  que[0].t = -1;
  node = 1;
  rate = start;
  minn = 0;
  ans = 0;
  for (i = 1; i <= n; i++) {
    while (que[node].t - que[i].t < len && node <= n) {
      ans += que[node].num ? c : -d;
      minn = min(ans, minn);
      node++;
    }
    if (minn + rate >= 0) {
      printf("%d\n", que[i - 1].t + 1);
      return 0;
    }
    ans -= (que[i].num ? c : -d);
    minn -= (que[i].num ? c : -d);
    rate += (que[i].num ? a : -b);
    if (rate < 0) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%d\n", que[n].t + 1);
  return 0;
}
