시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 2 2 2 100.000%

문제

The Party of Cyans and their honourable king Alexey decided to challenge Gennady in an upcoming CodeForces round. There are n party members in the first group, numbered from 1 to n, and n party members in the second group, numbered from n + 1 to 2n. There will be m problems in the round.

Alexey will distribute problems in the following way: for each problem, Alexey will assign exactly one party member from the first group and exactly one party member from the second group to work on this problem. After that, each party member will select exactly one problem to solve during the competition among the ones he was assigned to. A problem will be solved only if two party members will select it.

The party members will try their best and always maximize the number of solved problems.

However, members of the Party of Cyans don’t solve problems for free. Let c be the number of problems assigned to party member i. Then the amount of money Alexey will have to pay to that party member is pi,c.

Due to the competition rules, Alexey will beat Gennady only if his party solves at least l and at most r problems.

Help Alexey to win this competition while paying the minimum possible amount of money to party members.

입력

The first line contains integers n, m, l, and r: the number of party members in one group, the number of problems, and the left and right bounds (1 ≤ n ≤ 30, 0 ≤ m ≤ 30, 0 ≤ l ≤ r ≤ n).

The next 2 · n lines contain salary requirements for each party member: i-th of them contains m + 1 integers pi,0, pi,1, . . . , pi,m (−109 ≤ pi,j ≤ 109).

출력

If no money can help to beat Gennady, print “DEFEAT” on a single line.

Otherwise, on the first line, print one integer: the minimum possible total payment to the party members that will allow Alexey to win the competition. After that, print m more lines. On i-th of them, print two integers ai and bi, where ai is the number of the party member from the first group assigned to the i-th problem, and bi is the number of the party member from the second group assigned to the i=th problem.

If there are several possible solutions, print any one of them.

예제 입력 1

2 0 2 2
8
9
3
4

예제 출력 1

DEFEAT

예제 입력 2

2 8 2 2
2 5 5 10 -10 -1 3 5 9
8 -10 9 9 0 1 -3 1 -1
0 5 -1 5 3 -9 1 10 6
5 -4 8 -2 2 -8 6 3 -3

예제 출력 2

-21
1 3
2 4
1 3
1 3
1 3
2 3
2 4
2 4

예제 입력 3

3 5 2 3
100 75 125 150 175 200
125 100 75 100 125 150
225 200 175 200 225 250
225 200 175 200 225 250
125 100 75 100 125 150
100 75 125 150 175 200

예제 출력 3

650
1 4
2 5
3 6
2 4
3 5