beecrowd | 2499

Internal Triangle

By Francisco Elio Parente Arcos Filho, UEA BR Brazil

Timelimit: 1

Given a triangle ABC with area S, and N equidistant points on the side AB and M equidistant points on the BC side, calculate the triangle's area determined by one of these points in AB with coordinate C1 and two others over BC with coordinates C2 and C3.

Input

The input is composed by several test cases. The first line of a test case contains three integers S (1 ≤ S ≤ 106), N (0 ≤ N ≤ 103) and M (0 ≤ M ≤ 103) as specified in the text and the second line of a test case contains the coordinates C1 (0 ≤ C1 ≤ N+1), C2 (0 ≤ C2 ≤ M+1) and C3 (0 ≤ C3 ≤ M+1). The input ends when S=N=M=0.

Output

The output is composed by one line per test case containing the integer representing the area of the Triangle determined. It is always guaranteed that the area is an integer.

Input Sample Output Sample

4112 3 3
3 1 2
1000 3 4
2 1 2
0 0 0

771
100