Time limit
1s
Memory limit
128 MB
A rectangular sheet of grid paper has horizontal and vertical grid lines spaced 1 cm apart. One polygon is drawn on the sheet, and every side of the polygon lies on a grid line. After the polygon is cut out along its sides, one or more pieces of paper remain.
Given the width and height of the sheet and the polygon, write a program that prints the number of remaining pieces and the largest perimeter among those pieces.
In the first illustration, cutting out the drawn polygon leaves three pieces. Their perimeters are 36 cm, 14 cm, and 30 cm, so the largest perimeter is 36 cm.

If a remaining piece has a hole after the polygon is removed, the perimeter of that piece is the sum of the outer perimeter of the sheet and the perimeter of the removed polygon. In the next illustration, the perimeter of the remaining piece is 44 cm.

A shape is not considered a polygon if two vertices are at the same position, if two sides cross each other, or if two sides overlap even partially, as shown below.

The polygon is determined by its vertices, listed in counterclockwise order starting from any vertex. The position of each vertex is given by two numbers: how many grid cells it is to the right and how many grid cells it is above the lower-left corner of the sheet.
The first line contains two natural numbers: the width and height of the grid paper. Both values are at most 200000.
The second line contains a natural number, at most 500000, giving the number of vertices of the polygon.
Each of the following lines contains one vertex of the polygon in counterclockwise order. A vertex is given as two numbers separated by a space: its distance to the right and upward from the lower-left corner of the sheet, measured in grid cells.
Print two integers on one line: the number of pieces remaining after the polygon is cut out, and the largest perimeter among those pieces. Do not print the unit cm.