Bitie and his friends spent all of yesterday playing with colored bricks at the kindergarten. They built models first, got bored with them, and then decided to lay the bricks out in one long line. To keep the line from looking dull they never put two bricks of the same color next to each other, and after a long while every brick was in place. The day care closed and the children went home.
Bitie came back early this morning and was glad to see the line still standing. Then he tripped and fell right onto it, and the bricks scattered into a pile. He sorted them by color and started thinking about how to rebuild the line quickly. He still remembers the colors of the two bricks that were at the ends.
You are given how many bricks Bitie has of each color and the two colors he remembers. Build a line in which neighboring bricks always have different colors, the first brick has color p, and the last brick has color q. Bitie may have remembered the colors wrong, or some bricks may have stayed lost after the fall, so the line cannot always be rebuilt.
The first line contains the number of brick colors k, the color of the first brick p, and the color of the last brick q, separated by single spaces. (1≤k≤106, 1≤p,q≤k)
The second line contains k integers i1,i2,…,ik separated by single spaces. Bitie has exactly ij bricks of color j. (1≤ij≤106)
The total number of bricks n=i1+i2+⋯+ik is at most 106.
Print the colors of the n bricks in order on one line, separated by single spaces. The first color is p, the last color is q, and neighboring bricks have different colors.
When more than one line satisfies the conditions, print the lexicographically smallest one. When no line satisfies them, print the single integer 0.
To compare two lines A and B of the same length, look at the first position where their colors differ. The line with the smaller color number at that position comes first in lexicographic order.