eolymp
bolt
Try our new interface for solving problems
Problems

The painted points

The painted points

Time limit 0.1 seconds
Memory limit 64 MiB
prb297

Given the coordinates of the vertices of a triangle (which happen to be lattice points), you must count the number of lattice points that lie completely inside the triangle (points on the edges or vertices of the triangle do not count).

Input data

Each line consists of six integers x[1], y[1], x[2], y[2], x[3], and y[3], where (x[1], y[1]), (x[2], y[2]), and (x[3], y[3]) are the coordinates of triangle vertices. All triangles are non-degenerate (have positive area) and -15000x[1], y[1], x[2], y[2], x[3], y[3]15000. The last line contains six zeros and should not be processed.

Output data

For each input line print the number of internal lattice points in a single line.

Examples

Input example #1
1 1 1 6 6 1
0 0 0 0 0 0
Output example #1
6