시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB34614212641.584%

문제

백준이는 사과나무가 N개 심어져있는 땅의 일부를 구매했다. 백준이가 구매한 땅은 삼각형이다. 따라서, 어떤 사과나무가 백준이의 것인지 알기가 힘들었다.

백준이 땅의 꼭짓점 좌표와 사과나무의 좌표가 주어졌을 때, 백준이 땅의 넓이와 백준이의 사과나무의 개수를 구하는 프로그램을 작성하시오.

만약, 어떤 사과나무가 땅의 경계선에 걸쳐있다면, 이것은 백준이 사과나무이다.

(xA,yA), (xB,yB), (xC,yC) 로 이루어진 삼각형의 넓이는 다음과 같이 구할 수 있다.

|xA(yB-yC)+xB(yC-yA)+xC(yA-yB)| / 2

입력

처음 세 개의 줄은 삼각형의 꼭짓점 좌표이다. 다음 줄에는 사과나무의 개수 N이 주어진다. (1 ≤ N ≤ 100). 다음 N개의 줄에는 사과나무의 좌표가 주어진다.

모든 좌표는 1,000보다 작거나 같은 양의 정수이고, 공백으로 구분되어져 있다.

출력

첫째 줄에는 백준이 땅의 넓이를 소수점 첫째자리까지 출력하고, 둘째 줄에는 백준이의 사과나무 개수를 출력한다.

예제 입력 1

1 1
5 1
3 3
4
3 1
3 2
3 3
3 4

예제 출력 1

4.0
3

예제 입력 2

3 2
5 4
1 6
3
2 4
3 5
4 3

예제 출력 2

6.0
3

예제 입력 3

2 6
5 1
7 8
5
1 4
3 5
6 4
6 5
4 7

예제 출력 3

15.5
2
W3sicHJvYmxlbV9pZCI6IjI5ODciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMwYWNcdWFjZmNcdWIwOThcdWJiMzQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YmMzMVx1YzkwMFx1Yzc3NFx1YjI5NCBcdWMwYWNcdWFjZmNcdWIwOThcdWJiMzRcdWFjMDAgTlx1YWMxYyBcdWMyZWNcdWM1YjRcdWM4MzhcdWM3ODhcdWIyOTQgXHViNTQ1XHVjNzU4IFx1Yzc3Y1x1YmQ4MF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