cho.sh
Notes
Loading...

Assigning Tasks 1

Time limit

1s

Memory limit

512 MB

Problem

There are N people and N tasks. Each person must be assigned exactly one task, and each task must be assigned to exactly one person. Every person is capable of doing every task.

People and tasks are each numbered from 1 to N. Let D_{ij} be the cost for person i to perform task j. Find the minimum total cost needed to assign all N tasks.

Input

The first line contains the number of people and tasks, N (1 <= N <= 20). The next N lines contain the cost matrix D. Each of these lines contains N natural-number costs, and every cost is at most 10,000.

Output

Print the minimum total cost needed to assign all tasks.