A 2D space is fully covered by 1*1 mosaic pieces. Given three points p1 = (x1, y1), p2 = (x2, y2), p3 = (x3, y3), calculate the number of mosaic pieces that are fully within the triangle formed by those three points. Note that a mosaic piece is fully within the triangle if its four corners are all located inside the triangle, or on the edge of the triangle.
Take figure 1 for example. Given three points (3, 3), (10, 2) and (8, 8), there are 12 mosaic pieces located inside the triangle, which are colored in blue.
![figure 1]()
Input
The input file contains a single line with 6 integers x1, y1, x2, y2, x3 and y3, representing the three corners of the triangle.
p1, p2 and p3 will not be on the same line.
-1000 <= x1, y1, x2, y2, x3, y3 <= 1000
Output
Output the number of mosaic pieces fully located inside the triangle.
Task Description
A 2D space is fully covered by 1*1 mosaic pieces. Given three points p1 = (x1, y1), p2 = (x2, y2), p3 = (x3, y3), calculate the number of mosaic pieces that are fully within the triangle formed by those three points. Note that a mosaic piece is fully within the triangle if its four corners are all located inside the triangle, or on the edge of the triangle.
Take figure 1 for example. Given three points (3, 3), (10, 2) and (8, 8), there are 12 mosaic pieces located inside the triangle, which are colored in blue.
![figure 1]()
Input
The input file contains a single line with 6 integers x1, y1, x2, y2, x3 and y3, representing the three corners of the triangle.
Output
Output the number of mosaic pieces fully located inside the triangle.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
Sample Input 3
Sample Output 3