A 2D space is fully covered by $1 \times 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: p10133
Input Format
The input file contains a single line with $6$ integers $x1$, $y1$, $x2$, $y2$, $x3$ and $y3$, representing the three corners of the triangle.
Technical Limitation
$p1$, $p2$ and $p3$ will not be on the same line.
$-1000 \leq x1, y1, x2, y2, x3, y3 \leq 1000$
Output Format
Output the number of mosaic pieces fully located inside the triangle.
If you use a lot of outer product, be careful with overflow. For example, int val_ab = cross(???), val_bc = cross(???); cause val_ab * val_bc is large than 32-bit integer.