There are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot model's rating increases by *a* and after each fashion show decreases by *b* (designers do too many experiments nowadays). Moreover, sometimes top-models participates in talk shows. After participating in talk show model becomes more popular and increasing of her rating after photo shoots become *c* and decreasing of her rating after fashion show becomes *d*.

Izabella wants to participate in a talk show, but she wants to do it in such a way that her rating will never become negative. Help her to find a suitable moment for participating in the talk show. 

Let's assume that model's career begins in moment 0. At that moment Izabella's rating was equal to *start*. If talk show happens in moment *t* if will affect all events in model's life in interval of time [*t*..*t* + *len*) (including *t* and not including *t* + *len*), where *len* is duration of influence.

Izabella wants to participate in a talk show, but she wants to do it in such a way that her rating will not become become negative before talk show or during period of influence of talk show. Help her to find a suitable moment for participating in the talk show.
In first line there are 7 positive integers *n*, *a*, *b*, *c*, *d*, *start*, *len* (1 ≤ *n* ≤ 3·10<sup class="upper-index">5</sup>, 0 ≤ *start* ≤ 10<sup class="upper-index">9</sup>, 1 ≤ *a*, *b*, *c*, *d*, *len* ≤ 10<sup class="upper-index">9</sup>), where *n* is a number of fashion shows and photo shoots, *a*, *b*, *c* and *d* are rating changes described above, *start* is an initial rating of model and *len* is a duration of influence of talk show.

In next *n* lines descriptions of events are given. Each of those lines contains two integers *t*<sub class="lower-index">*i*</sub> and *q*<sub class="lower-index">*i*</sub> (1 ≤ *t*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>, 0 ≤ *q* ≤ 1) — moment, in which event happens and type of this event. Type 0 corresponds to the fashion show and type 1 — to photo shoot. 

Events are given in order of increasing *t*<sub class="lower-index">*i*</sub>, all *t*<sub class="lower-index">*i*</sub> are different.
none
5 1 1 1 4 0 5
1 1
2 1
3 1
4 0
5 0
6
1 1 2 1 2 1 2
1 0
-1
10 1 1 1 2 0 10
1 1
2 1
3 0
4 0
5 1
6 1
7 1
8 1
9 1
10 1
5
# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys

"""
created by shhuan at 2017/11/4 01:08

"""



n, a, b, c, d, start, l = map(int, input().split())

A = []
for i in range(n):
    t, q = map(int, input().split())
    A.append((t, q))


# fashion show, -b, -d
# photo shoot, +a, +c


left1 = [0] * (n+1)
left2 = [0] * (n+1)
left1[0] = start
left2[0] = start
lasti = -1

for i in range(1, n+1):
    t, q = A[i-1]
    # q=0, fashion show
    # q=1, photo shoot
    if q == 0:
        left1[i] = left1[i-1] - b
        left2[i] = left2[i-1] - d
    else:
        left1[i] = left1[i-1] + a
        left2[i] = left2[i-1] + c

    if lasti < 0 and left1[i] < 0:
        lasti = i

se = set()
uk = 1
for i in range(0, n+1):
    if left1[i] < 0:
        print(-1)
        exit(0)

    if i:
        se.remove(left2[i])
    while uk <= n and A[uk][0] - 1 < A[i][0] + l:
        se.add(left2[uk])
        uk += 1

    if not se:
        print(A[i][0] + 1)
        exit(0)

    v = min(se)
    v += left1[i] - left2[i]
    if v >= 0:
        print(A[i][0] + 1)
        exit(0)




