#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long INF = 1ll << 60;
const int LOGN = 19;
const int N = 1 << LOGN;
long long sp[LOGN][1 << LOGN], k[1 << LOGN], o[1 << LOGN];
int n;
void sparseTable() {
  for (int j = 1; j < LOGN; j++) {
    for (int i = 0; (i + (1 << j) - 1) < n; i++) {
      sp[j][i] = min(sp[j - 1][i], sp[j - 1][i + (1 << (j - 1))]);
    }
  }
  for (int i = 2; i <= n; i++) {
    k[i] = k[i - 1] + ((i & (i - 1)) == 0);
    if (k[i] == k[i - 1])
      o[i] = o[i - 1];
    else
      o[i] = ((o[i - 1] + 1) << 1) - 1;
  }
  return;
}
long long rmq(int x, int y) {
  int l = y - x + 1;
  return min(sp[k[l]][x], sp[k[l]][y - o[l]]);
}
long long cumsum[N];
long long a, b, c, d, start, len;
vector<pair<long long, long long> > shows;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> a >> b >> c >> d >> start >> len;
  for (int i = 0; i < n; i++) {
    long long t, q;
    cin >> t >> q;
    shows.push_back(make_pair(t, q));
  }
  for (int i = 0; i < n; i++) {
    if (shows[i].second == 0) {
      cumsum[i] = (i > 0) ? (cumsum[i - 1] - d) : (-d);
    } else {
      cumsum[i] = (i > 0) ? (cumsum[i - 1] + c) : (c);
    }
    sp[0][i] = cumsum[i];
  }
  sparseTable();
  long long ans = INF;
  if (shows[0].first > len - 1) ans = 0;
  bool fuckyou = true;
  long long tmp = start;
  for (int i = 0; i < n; i++) {
    if (shows[i].second == 0)
      tmp -= b;
    else
      tmp += a;
    if (tmp < 0) fuckyou = false;
    if (fuckyou and i + 1 < n and shows[i].first + len < shows[i + 1].first)
      ans = min(ans, shows[i].first + 1);
  }
  if (fuckyou and tmp >= 0) ans = min(ans, shows[n - 1].first + 1);
  set<long long> events;
  events.insert(0);
  for (int i = 0; i < n; i++) {
    events.insert(max(0ll, shows[i].first - len + 1));
    events.insert(shows[i].first + 1);
  }
  bool flag = true;
  int sptr = 0, ptr = 0;
  for (long long time : events) {
    if (shows[sptr].first > time + len - 1) continue;
    while (sptr < n and shows[sptr].first < time) {
      if (shows[sptr].second == 0) {
        start -= b;
      } else {
        start += a;
      }
      if (start < 0) {
        flag = false;
        break;
      }
      sptr++;
    }
    if (!flag) break;
    if (sptr == n) {
      ans = min(ans, time);
      break;
    }
    while (ptr < n and shows[ptr].first <= time + len - 1) ptr++;
    ptr--;
    long long mn = rmq(sptr, ptr);
    if (sptr > 0) mn -= cumsum[sptr - 1];
    if (start + mn >= 0 and time < ans) {
      ans = time;
    }
  }
  if (ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}
