#include <bits/stdc++.h>
using namespace std;
pair<int, int> s[300005];
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", &s[i].first, &s[i].second);
  long long sum = 0, res = 0, ans = start;
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (j < n && s[j].first - s[i].first < len) {
      sum += (s[j].second ? c : -d);
      res = min(res, sum);
      j++;
    }
    if (ans + res >= 0) {
      if (!i)
        printf("%d\n", 0);
      else
        printf("%d\n", s[i - 1].first + 1);
      return 0;
    }
    ans += (s[i].second == 0 ? -b : a);
    sum -= (s[i].second == 0 ? -d : c);
    res -= (s[i].second == 0 ? -d : c);
    if (ans < 0) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%d\n", s[n - 1].first + 1);
}
