#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int SIZE = 1e5 + 10;
int t[SIZE * 3], thing[SIZE * 3];
int main() {
  int a, b, c, d, start, len, n;
  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", &t[i], &thing[i]);
  vector<int> T;
  T.push_back(-1);
  for (int i = 0; i < n; i++) T.push_back(t[i]);
  int now = 0;
  long long ori = start, ans = 0, MIN = 0;
  for (int i = 0; i < n; i++) {
    while (now < n && t[now] - t[i] < len) {
      ans += thing[now] ? c : -d;
      MIN = min(ans, MIN);
      now++;
    }
    if (MIN + ori >= 0) {
      printf("%d\n", T[i] + 1);
      return 0;
    }
    ans -= (thing[i] ? c : -d);
    MIN -= (thing[i] ? c : -d);
    ori += (thing[i] ? a : -b);
    if (ori < 0) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%d\n", T[n] + 1);
  return 0;
}
