This page is still under construction.

Parts of this page are still being built. What you see may change.

Twin Buildings

Time limit2sMemory limit512 MB

Summary
Given N rectangular lands, find the maximum area A×B of two identical rectangles placed either on separate lands or both on one land, printed with one decimal.
Level

Medium7 of 10

Topics
Sorting, Greedy, Math
Solved
No attempts yet

Problem

As you might already know, space has always been a problem in ICPC Jakarta. To cope with this, ICPC Jakarta is planning to build two new buildings. These buildings should have a shape of a rectangle of the same size. Now, their problem is to find land to build the buildings.

There are N lands available for sale. The ith land has a rectangular shape of size Li × Wi. For a good feng shui, the building's side should be parallel to the land's sides.

One way is to build the two buildings on two different lands, one on each land (not necessarily with the same orientation). A building of size A × B can be built on the ith land if and only if at least one of the following is satisfied:

  • A ≤ Li and B ≤ Wi, or
  • A ≤ Wi and B ≤ Li.

Alternatively, it is also possible to build two buildings of A × B on the ith land with the same orientation. Formally, it is possible to build two buildings of A × B on the ith land if and only if at least one of the following is satisfied:

  • A × 2 ≤ Li and B ≤ Wi, or
  • A × 2 ≤ Wi and B ≤ Li, or
  • A ≤ Li and B × 2 ≤ Wi, or
  • A ≤ Wi and B × 2 ≤ Li.

Your task in this problem is to help ICPC Jakarta to figure out the largest possible buildings they can build given N available lands. Note that ICPC Jakarta has to build two buildings of A × B; output the largest possible for A × B.

Input

Input begins with a line containing an integer: N (1 ≤ N ≤ 100 000) representing the number of available lands. The next N lines each contains two integers: Li Wi (1 ≤ Li, Wi ≤ 10^9) representing the size of the land.

Output

Output in a line a number representing the largest building that ICPC Jakarta can build with exactly one decimal point (see sample input/output for clarity).

Examples3

  1. Example 1

    Input
    2
    5 5
    3 4
    
    Expected output
    12.5
    
  2. Example 2

    Input
    2
    2 5
    4 3
    
    Expected output
    8.0
    
  3. Example 3

    Input
    3
    10 1
    9 8
    7 6
    
    Expected output
    42.0