Under construction

Still being built. Things may change

Dream, Passion, Sharing

Interview

Time limit2sMemory limit1024 MB

Summary
Pick Jaewon plus up to M-1 students whose stat totals do not exceed his own, so the team's combined total is maximized.
Level

Easy3 of 10

Topics
Greedy, Sorting
Solved
No attempts yet

Problem

Jaewon is a Dimigo student who is choosing teammates for the Dimigo startup idea contest.

A team can enter the contest with at most MM members.

Under the school motto of dream, passion, and sharing, each of the N+1N+1 Dimigo students, including Jaewon, has dream, passion, and sharing stats. Jaewon's number is 00, and his stats are V0V_0, P0P_0, and S0S_0. The other NN students are numbered from 11 to NN, and student ii has stats ViV_i, PiP_i, and SiS_i.

Jaewon wants to choose teammates so that the team, including himself, has at least 1 and at most MM members, and the total of all members' dream, passion, and sharing stats is as large as possible.

Jaewon wants to keep his team easy to manage, so he will not pick any student whose stat total is greater than his own stat total V0+P0+S0V_0+P_0+S_0.

Input

The first line contains the number of students NN and the maximum team size MM, separated by a space. (1≤N≤105;(1 \leq N \leq 10^5; 1≤M≤N+1)1 \leq M \leq N+1)

The second line contains Jaewon's stats V0V_0, P0P_0, and S0S_0, separated by spaces. (1≤V0,P0,S0≤108)(1 \leq V_0, P_0, S_0 \leq 10^8)

From the third line onward, the NN lines give student ii's stats ViV_i, PiP_i, and SiS_i, separated by spaces. (1≤i≤N;(1 \leq i \leq N; 1≤Vi,Pi,Si≤108)1 \leq V_i, P_i, S_i \leq 10^8)

All input numbers are integers.

Output

Print the numbers of the students on the team, including Jaewon's number, separated by spaces, for a team that satisfies the conditions.

If several teams maximize the total stats, print any one of them.

The members may be printed in any order.

Examples2

  1. Example 1

    Input
    3 2
    10 10 10
    10 9 10
    9 10 11
    10 15 10
    
    Expected output
    0 2
    
  2. Example 2

    Input
    5 4
    5 5 5
    5 5 4
    5 5 5
    5 5 6
    5 5 7
    5 5 8
    
    Expected output
    0 1 2