You are capturing the awesome meteor shower tonight. We model the vision seen through the camera lens as a rectangle R on the two dimensional grid, with two sides parallel to the x-axis and the other two sides parallel to the y-axis. Meteors are modeled as line segments on the grid. We can capture a meteor if there is point p on the line segment representing that meteor such that p ∊ R, and we say p ∊ R if p falls inside the rectangle R or on its boundary.
Count the number of meteors that can be captured.
Each test case begins with five space-separated integers N (1 ≤ N ≤ 1000), X1, Y1, X2, Y2 (X1 < X2, Y1 < Y2, |X1|, |Y1|, |X2|, |Y2| ≤ 1000) in a line, where N denotes the number of visible meteors on the two dimensional grid, and (X1, Y1) and (X2, Y2) represent the lower-left and upper-right coordinates of the rectangle R.
There are N lines follow, each line consists of four integers x1, y1, x2, y2 (|x1|, |y1|, |x2|, |y2| ≤ 1000), where (x1, y1) and (x2, y2) are two end points of the line segment representing the meteor.
There is a blank line after each test case, and the input is terminated by a line consists of five zeros.
Output an integer in a line for each test case, which is the number of meteors that can be captured.