Matrix (Easy)#5313

Matrix (Easy)

1 second
64 megabytes
Very hard (≈2050)

You are given an n \times n matrix of integers. Your task is to select a set of coordinates (k_i, l_i) such that each row index k_i and each column index l_i is used exactly once, in order to minimize the sum of the selected matrix elements.

Input

The first line contains a single integer (1 \leq n \leq 50). The following lines each contain integers, each within the range -10^6 to 10^6.

Output

The first line should display the minimum possible sum. In the following lines, output the pairs of numbers representing the selected cells, with the row number given first.

Examples

Example 1

Loading
Loading