Square Counting#1701

Square Counting

1 second
64 megabytes
Hard

A simple polygon with vertices given by integer coordinates is drawn on a checkerboard. Count the number of light and dark unit squares that are completely contained within the polygon.

Input

Several test cases are given (at most ). Each test case begins with an integer (3 \leq n \leq 100), the number of vertices of the polygon. Each of the next lines contains two integers and (0 \leq x \leq 10000, 0 \leq y \leq 10000), representing the coordinates of a vertex of the polygon. The input ends with a line n = 0, which should not be processed. You may assume that the top left corner has coordinates . The illustration above corresponds to the first sample input.

Output

For each test case, output on a separate line two integers: the numbers of light and dark unit squares completely contained within the polygon, in descending order.

Examples

Example 1

Loading
Loading