1324 - 两地调度

通过次数

8

提交次数

13

Time Limit : 1 秒
Memory Limit : 128 MB

公司计划面试 2n 人。给你一个数组 costs ,其中 costs[i] = [aCosti, bCosti] 。第 i 人飞往 a 市的费用为 aCosti ,飞往 b 市的费用为 bCosti

返回将每个人都飞到 ab 中某座城市的最低费用,要求每个城市都有 n 人抵达。

Input

第一行为一个整数2n,表示有2n个人面试

以下2n行,每行2个整数,第一个整数为去a市的费用,第二个证书为去b市的费用

Output

每个城市都有 n 人抵达的最低费用

Examples

Input

4
10 20
30 200
400 50
30 20

Output

110

Input

6
259 770
448 54
926 667
184 139
840 118
577 469

Output

1859

Input

8
515 563
451 713
537 709
343 819
855 779
457 60
650 359
631 42

Output

3086

Hint

  • 2 * n == costs.length

  • 2 <= costs.length <= 100

  • costs.length 为偶数

  • 1 <= aCosti, bCosti <= 1000