Prime Cut 3


Wahoo!

It's a me, Mario! I need you to help me win a round of Mario Party Jamboree (TM).

I have to play a minigame with my bro, Luigi, called Prime cut. In this game I get a steak and cut it in 2 equal portions, can you find a cut for me?

The steak is a 2d convex polygon (no internal angle is greater than 180 degrees). You have to find the value of aa such that the line x=aa cuts the steak into 2 pieces of equal size. In other words, you have to find the vertical line that splits the steak into 2 halves.

Input

The first line has one integer, nn, the number of points in the steak The next nn lines each have 2 integers, xix_i yiy_i, the x and y value of the ith point.

  • −1e4≤xi,yi≤1e4-1e4 \le x_i, y_i \le 1e4
  • 1000≤n≤1e51000 \le n \le 1e5

It is guaranteed that no 3 successive points in the the steak are collinear, or form an internal angle greater than 180 degrees. All points are distinct.

Output:

Give me the x-value of the line that divides the steak in 2. Answers within 1e-3 will be accepted.

Sample Input:

Input 1
3
0 0
1 1
0 1

Sample Output:

Output 1
0.2928931713

Sample Input:

Input 2
4
1 1
3 1
3 4
1 4

Sample Output:

Output 2
2

Sample Input:

Input 3
5
0 0
1 0
1 1
0 2
-1 1

Sample Output:

Output 3
0.1291712523

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.