Max Pair Matching

문제

You are given 2n pairs (ai,bi) of integers. Consider a complete graph on 2n vertices and define the weight of the edge (ij) to be wij=max(|aiaj|,|aibj|,|biaj|,|bibj|).

Determine the maximum weight of the matching in this graph.

In other words, consider all ways to select n edges of this graph such that no two chosen edges have a common endpoint. What is the maximum possible total weight of these edges?

입력

The first line of the input contains a single integer n (1n105).

The i-th of the next 2n lines contain two integers ai and bi (0ai,bi109).

출력

Print a single integer --- the maximum weight of the matching in this graph.

힌트

Adjacency matrix: 07915703893011158110

예제 입력 1 복사

2
0 10
7 7
9 4
2 15

예제 출력 1 복사

18