#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double E = exp(1.0);
const double eps = 1e-30;
const double INFD = 1e20;
const long long INFLL = 0x3f3f3f3f3f3f3f3fll;
const int INF = 0x3f3f3f3f;
const int maxn = (int)3e5 + 10;
const int MAXN = (int)5e3 + 10;
const int MOD = (int)1e9 + 7;
long long n, a, b, c, d, start, len;
struct node {
  long long t;
  int type;
} show[maxn];
void solve() {
  show[0].t = -1;
  long long rank = start;
  long long minn = 0;
  long long sum = 0;
  for (int i = 1, j = 1; i <= n; ++i) {
    for (; j <= n; ++j) {
      if (show[j].t - show[i].t > len) break;
      if (show[j].type) {
        sum += c;
      } else {
        sum -= d;
      }
      minn = min(minn, sum);
    }
    if (rank + minn >= 0) {
      printf("%lld\n", show[i - 1].t + 1);
      return;
    }
    if (show[i].type) {
      rank += a;
      sum -= c;
      minn -= c;
    } else {
      rank -= b;
      sum += d;
      minn += d;
    }
    if (rank < 0) {
      puts("-1");
      return;
    }
  }
  printf("%lld\n", show[n].t + 1);
}
void RUN() {
  while (~scanf("%lld %lld %lld %lld %lld %lld %lld", &n, &a, &b, &c, &d,
                &start, &len)) {
    for (int i = 1; i <= n; ++i) {
      scanf("%lld %d", &show[i].t, &show[i].type);
    }
    solve();
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  RUN();
  return 0;
}
