Question
Intern Task Allocation

A team lead has N interns and N tasks. Each intern must get exactly one task, and each task must be assigned to exactly one intern. The fatigue cost of assigning intern i to task j is given.

Find the minimum total fatigue cost.

The twist: assigning the cheapest task to the current intern can steal the best task from a later intern.

Input

The first line contains an integer KaTeX can only parse string typed expression.

The next KaTeX can only parse string typed expression lines contain KaTeX can only parse string typed expression integers each. The value in row KaTeX can only parse string typed expression and column KaTeX can only parse string typed expression is the cost of assigning intern KaTeX can only parse string typed expression to task KaTeX can only parse string typed expression.

Output

Print a single integer — the minimum possible total fatigue cost.

Example
Example 1:
Input
3

9 2 7
6 4 3
5 8 1
Output
9
Explanation
One optimal assignment is intern 1 to task 2, intern 2 to task 1, and intern 3 to task 3.

Example 2:
Input
2

5 1
2 4
Output
3

Online