Rain Again

Find the fewest leading drops so every W by H rectangle inside the L by L pot contains a drop strictly inside, or report -1.

Hard8Binary searchSegment treeGeometryNo attempts yetTime limit2sMemory limit256 MB

Problem

Elly keeps an LL by LL pot full of flowers on her terrace. She and Stancho often sit beside it and talk while watching the flowers. Once it starts raining, Elly stops listening to Stancho and watches where the drops land. She goes back to listening the moment she decides the flowers are well watered, and Stancho wants to know when that moment comes.

The upper surface of the pot is a square in the coordinate plane, and its corners are (0,0)(0, 0), (0,L)(0, L), (L,L)(L, L) and (L,0)(L, 0). During the rain, NN drops fall into the pot one after another.

Elly considers the flowers well watered once every W×HW \times H rectangle that fits inside the pot has at least one drop strictly inside it. The sides of the rectangle are parallel to the sides of the pot. The side of length WW is parallel to the xx axis and the side of length HH is parallel to the yy axis. The rectangle may not stick out of the pot, so its lower left corner (x,y)(x, y) is any real point with 0xLW0 \le x \le L - W and 0yLH0 \le y \le L - H.

A drop (Xi,Yi)(X_i, Y_i) is strictly inside such a rectangle when x<Xi<x+Wx < X_i < x + W and y<Yi<y+Hy < Y_i < y + H. A drop that lands on the border of the rectangle does not count as being inside it.

Find how many drops have fallen at the moment the flowers first become well watered.

Input

The first line contains the number of drops NN, the side length of the pot LL, and the width WW and height HH of the rectangle Elly looks at.

Each of the next NN lines contains the coordinates XiX_i and YiY_i of one drop, in the order the drops fall.

Output

Print, on a single line, the number of drops that have fallen at the moment the flowers first become well watered. If some W×HW \times H rectangle still has no drop strictly inside it after all NN drops have fallen, print -1 instead.

Constraints

  • 1N1000001 \le N \le 100000
  • 1L1091 \le L \le 10^9
  • 1WL1 \le W \le L, 1HL1 \le H \le L
  • 0XiL0 \le X_i \le L, 0YiL0 \le Y_i \le L
  • All numbers in the input are integers.

Hint

In the first example, after the 13th drop lands at (4,2)(4, 2), no 5×45 \times 4 rectangle without a drop strictly inside it is left.