Time

12:55:59
23 May 2012
Version for print

The Cells are Painted out

prb59   On the sheet of paper in a cell is the broken line with N summits. They lie on the crossings of the lines of the net. All of cells which was crossed by broken line painted out (a cell is considered crossed if it has even one general point with broken line). You have to calculate the quantity of the painted out cells if beginning of the system of coordinates lies on the crossing of the lines of the net and parallel to lines of the net, and a single segment equals the side of cell.


Specifications

   Input

   There is a natural number N – the quantity of the summits of the broken line in the first line. In next N lines are two integers, absence is between them. Each of them is co-ordinates each of summits of the broken line. All of numbers do not exceed 100 by the module.

   Output

   You have to write the quantity of the crossed cells.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 40% 21/35

Example

Example input

3
2 3
-2 0
1 -2

Example output

18


← The Billiards Problems The Area of the Polygon →