Post office#8705

Post office

1 second
64 megabytes
Very easy

We have rectangular postcards, each with dimensions x_i and y_i for i = 1 \ldots n. There are also two types of postal envelopes available in unlimited quantities: one with dimensions a \times b and the other with dimensions c \times d. Each envelope can hold only one postcard, and the postcard must be placed such that its sides are parallel to the sides of the envelope and do not exceed the envelope's dimensions.

What is the maximum number of postcards that can be placed into the envelopes?

Input

The first line contains the integers , , , , . The following lines each contain two integers, x_i and y_i, representing the dimensions of each postcard. All values are natural numbers and do not exceed .

Output

Output the maximum number of postcards that can be placed into the envelopes.

Examples

Example 1

Loading
Loading