A polygon is drawn in the Cartesian plane. Its sides are parallel to the coordinate axes, every two consecutive sides are perpendicular, and every vertex has integer coordinates. You are also given a window, a rectangle whose sides are parallel to the axes. The interior of the polygon (but not its boundary) is coloured red. Determine how many separate red fragments of the polygon can be seen through the window.
The figure below shows an example. Through this window you can see two separate red fragments of the polygon.

Write a program that:
The first line contains four integers x1, y1, x2, y2, each from 0 to 10000, separated by single spaces. (x1, y1) are the coordinates of the top-left corner of the window and (x2, y2) are the coordinates of the bottom-right corner.
The next line contains one integer n, the number of vertices of the polygon, with 4 ≤ n ≤ 5000. Each of the following n lines contains two integers x and y separated by a single space, with 0 ≤ x ≤ 10000 and 0 ≤ y ≤ 10000. These are the coordinates of the polygon's vertices listed in anticlockwise order, so the interior of the polygon lies on the left-hand side as you walk along its boundary in the given order. The i-th of these lines gives the coordinates of the i-th vertex.
Print a single integer: the number of separate red fragments of the polygon that can be seen through the window.