DORUCAK | 프로그래밍의 벗 PivotOJ
PivotOJ

DORUCAK

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2008 Final Exam #2BOJ 3137
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

Mirko and Slavko like to eat burek for breakfast. This one time they bought one with cheese and another with meat. Watching the hot bureks on the table, teasing their nostrils with enticing aromas, they could not decide on who would get which burek so they decided to split both of them in halves. Mirko boasted that he could cut both bureks in two halves of equal areas with just one swift stroke of his knife. Help Mirko accomplish this before the bureks get cold.

[이미지 1]

Image corresponds to first example.

Each of the bureks is a convex polygon. The bureks are positioned so that one of them is completely left of the y-axis, and the other completely right of it.

Write a program that, given the coordinated of the polygons, calculates the equation of the line that splits both bureks into two halves of equal areas.

입력

The first line contains an integer N (3 ≤ N ≤ 5000), the number of vertices in the first burek.

Each of the following N lines contains two real numbers X and Y in decimal format (−1000 < X < 0, −1000 < Y < 1000), the coordinates of one vertex in the burek.

The remainder of the input describes the second burek in the same format.

In both bureks, the vertices will be given in counter-clockwise order. The coordinates of the vertices will be given with exactly three digits after the decimal point. No three points in a polygon will be collinear.

출력

Output two numbers A and B so that y = A ⋅ x + B describes a line for Mirko to use to cut the bureks. Your output must be accurate to ±0.001.

Note: the solution always exists and is unique.

예제

예제 1

입력
3
-6.000 1.000
-2.000 2.000
-5.000 6.000
5
1.000 -1.000
3.000 -2.000
6.000 0.000
4.000 3.000
1.000 2.000
출력
-0.319961 1.556489

예제 2

입력
4
-5.000 -1.000
-3.000 -1.000
-3.000 6.000
-5.000 6.000
4
3.222 2.000
5.000 1.000
5.000 4.000
3.222 3.000
출력
0.000000 2.500000
코드를 제출하려면 로그인하세요.