#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000;
int t[maxn];
long long sum1[maxn], sum2[maxn];
int main() {
  int n, a, b, c, d, start, len;
  int q;
  scanf("%d%d%d%d%d%d%d", &n, &a, &b, &c, &d, &start, &len);
  sum1[0] = start;
  sum2[0] = start;
  int flag = -1;
  t[0] = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &t[i], &q);
    if (q == 1) {
      sum1[i] = sum1[i - 1] + a;
      sum2[i] = sum2[i - 1] + c;
    } else if (q == 0) {
      sum1[i] = sum1[i - 1] - b;
      sum2[i] = sum2[i - 1] - d;
    }
  }
  multiset<long long> ms;
  int p = 1;
  for (int i = 0; i <= n; i++) {
    if (sum1[i] < 0) {
      break;
    }
    while (p <= n && (t[p] - t[i] - 1) < len) {
      ms.insert(sum2[p++]);
    }
    if (i) ms.erase(ms.find(sum2[i]));
    if (ms.size() == 0) {
      flag = t[i] + 1;
      break;
    }
    long long val = *ms.begin();
    if (sum1[i] - sum2[i] + val >= 0) {
      flag = t[i] + 1;
      break;
    }
  }
  printf("%d", flag);
  return 0;
}
