#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int maxm = 1e5 + 5;
int t[maxn], p[maxn];
int n, a, b, c, d, len;
long long s;
long long sum;
int main() {
  scanf("%d %d %d %d %d %lld %d", &n, &a, &b, &c, &d, &s, &len);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &t[i], &p[i]);
  }
  int now = 1, tm;
  long long m = 1e16;
  t[0] = -1;
  for (int i = 1; i <= n; ++i) {
    tm = t[i - 1] + 1 + len - 1;
    while (now <= n && t[now] <= tm) {
      sum += p[now++] ? c : (-d);
      m = min(m, sum);
    }
    if (s + m >= 0) return printf("%d\n", i > 1 ? (t[i - 1] + 1) : 0), 0;
    p[i] ? (m -= c, sum -= c, s += a) : (m += d, sum += d, s -= b);
    if (s < 0) return printf("-1\n"), 0;
  }
  return printf("%d\n", t[n] + 1), 0;
}
