Under construction

Still being built. Things may change

Escape from Asgard

Interview

Time limit2sMemory limit1024 MB

Summary
Split groups of people between an upper deck with A seats and a lower deck with B seats, and check whether group 1 can sit on the upper deck.
Level

Medium5 of 10

Topics
Dynamic programming, Array
Solved
No attempts yet

Statement

Thor and the other residents of Asgard are escaping on the Grandmaster's ship. But first they have to board it.

The ship has two decks. The upper deck has AA seats and the lower deck has BB seats. The entrance is on the upper deck. Thor directs the boarding. It is not simple, though. The residents form groups of friends, and each group wants to sit entirely on one deck so they can talk easily. Thor is in group 1. Since Thor directs the boarding, his group boards last, and to avoid delaying the departure, they want to sit on the upper deck.

Determine whether the groups can be split between the two decks so that everyone gets a seat. If so, determine whether the split can also place group 1, Thor's group, on the upper deck.

Input

The first line contains integers nn, AA, and BB: the number of groups, the number of seats on the upper deck, and the number of seats on the lower deck (1≤n≤1001 \le n \le 100, 1≤A,B≤1051 \le A, B \le 10^5). The next line contains nn integers aia_i, the number of people in each group (1≤ai≤10001 \le a_i \le 1000).

Output

If the groups cannot be split so that all people get seats, print −1-1. Otherwise, if group 1 can be on the upper deck, print 11; if not, print 22. The next two lines describe the upper deck, then the lower deck. Each line starts with the number of groups on that deck, followed by the group numbers. Groups are numbered from 1 in input order.

Examples1

  1. Example 1

    Input
    3 4 3
    3 2 2
    
    Expected output
    2
    2 2 3
    1 1