Problem1520--Carpets

1520: Carpets

[Creator : ]
Time Limit : 1 sec  Memory Limit : 128 MB

Description

 

In order to prepare a unique award ceremony, the organizers put a number of rectangular carpets in a rectangular area (seen as the first quadrant of the plane right angle coordinate), with a total of N carpets from 1 to n. Now these carpets are laid out in sequence from small to large, parallel to the coordinate axis, and the carpet behind is covered on the carpet that has been paved in front.

When the carpet is laid, the organizer wants to know the number of the top carpet covering a certain point on the ground. Note: the points on the side of the rectangular carpet and the four vertices are also covered by carpet.

Input

 

Enter a common n+2 line.

The first line has an integer n indicating that there is a n carpet in total.

In the next N line, line i+1 represents the information of the carpets of the numbered I, including four positive integers, a,b,g,k, and each two integers are separated by a space, representing the coordinates of the lower left corner of the carpets (a, b), and the length of the carpet in the X axis and Y axis.

Line n+2 contains two positive integers x and y, which represent the coordinates of the ground points (x, y).

Output

Output a total of 1 rows, an integer, indicating the number of carpets requested; if it is not covered by carpet, then output -1.

Sample Input Copy

3
1 0 2 3
0 2 3 3
2 1 3 3
2 2

Sample Output Copy

3

HINT

数据范围:

30% n<=2

50% 0<=a,b,g,k<=100

100% 0<=n<=10000, 0<=a,b,g,k<=100000

NOIP2011 DAY1 carpet

Source/Category