Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Saskatchewan
Time Limit: 8000MSMemory Limit: 65536K
Total Submissions: 876Accepted: 220
Case Time Limit: 3000MS

Description

The province of Saskatchewan is surveyed in sections. A section is a square mile of land. Grid roads delimit sections; there is one north-south and one east-west road exactly every mile. (Complications arise because of the curvature of the earth but you can disregard these and assume that the province is a plane.) The provincial border is a polygon whose vertices correspond to the intersections of grid roads. However, the edges do not necessarily follow grid roads; some sections are cut by the border. Your job is to compute how many sections are completely within a province like Saskatchewan.

Input

Standard input contains a series of no more than 100 coordinate pairs, one pair per line. These coordinates give the vertices of the perimeter of the province; the border is formed by connecting them in order. All coordinates are in the first quadrant; they range from 0 to 100,000.

Output

Your output should be a single integer: the number of sections (i.e. unit squares with corners at integer coordinates) fully contained within the province.

Sample Input

0 0
0 100000
99999 100000
100000 0

Sample Output

9999900000

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator