LearnPy Hub
← Arena
AdvancedRating 1600

Two Cities

2n people each have a cost to fly to city A and to city B. Send exactly n to each city with minimum total cost.

Input

2n, then 2n lines 'costA costB'.

Output

A number.

Sample 1

Input
4
10 20
30 200
400 50
30 20
Output
110

Sample 2

Input
2
1 2
2 1
Output
2
solution.py
Output appears here
Two Cities · Python Arena problem · LearnPy Hub