Assignment problem#1781

Assignment problem

1 second
128 megabytes
Very easy

One of the classical problems in combinatorial optimization is the assignment problem. It is formulated as follows.

There are workers, numbered from to , and jobs, also numbered from to . If the -th worker is assigned to the -th job, he receives a salary of c_{ij} units of money. Find such an assignment of workers to jobs (each worker is assigned to exactly one job, each job is assigned to exactly one worker) so that the total salary is minimized (the corresponding sum is called the cost of the assignment).

Write a program to solve the assignment problem.

Input

The first line contains an integer (1 \le n \le 10).

Each of the next lines contains integers. The -th number of the (i + 1)-th line equals c_{ij} (1 \le c_{ij} \le 1000).

Output

Print the minimum possible assignment cost.

Examples

Example 2

Loading
Loading

Example 1

Loading
Loading