A Greener World

Suppose that there is a two-dimensional grid. But the grid is a bit special: the grid lines are d units apart instead of 1. If such a grid is skewed it will look like the grid shown in picture below (All the squares have become rhombuses and the angle between x-axis and y-axis is θ instead of 90 degree). The intersection of any two grid lines is called a lattice vertex. Initially trees are planted in all the lattice vertices shown with green circles in the picture above. Bill and Marsha buy a land of polygonal shape in this infinite lattice grid-land. All the vertices of the polygon are coincident with one of the lattice vertices. After Bill and Marsha buys the land the government issues a new law: “Two make the landscape even greener everyone must plant another plant at the center of each smallest rhombus”. These new plants are shown with red circles in the picture above. Given the shape of the land of Bill and Marsha your job is to suggest them how many new trees must be planted by them within their land according to the new law imposed by the government? You can assume that on trees have zero radius and trees planted on the boundary of the land of Bill and Marsha are not considered inside the land. OOPS! I forgot to tell you that you also need to find out the area of the land of Bill and Marsha.

2/2 Input The input file contains at most 15 sets of inputs. The description of each set is given below: Each set starts with three integers d (0 < d < 10000), θ (44o < θ < 136o) and N. The meaning of d and θ is given in the problem statement and N denotes the number of vertices of the polygonal land. Each of the next N lines contains two integers x, y (0 ≤ x, y ≤ 100000) which denote the coordinate of a vertex of the polygonal shaped land. The coordinates of the vertices are given in clockwise or anti-clockwise order along the edges of the polygonal shaped land. Input is terminated by a case where the value of d, θ and N are zero. Output For each set of input output two integers. The first integer denotes the number of new plants to be planted in the land of Bill and Marsha and the second integer denotes area of the land of Bill and Marsha rounded to the nearest integer. The second sample input corresponds to the figure on the first page. Sample Input 10 45 4 00 0 1000 999 1000 1000 0 10 76 5 2 -2 46 -3 5 -5 1 -2 2 000 Sample Output 999500 70675323 33 3493