A. Tower Defense

Zombies are after you. You need to improvise some sort of barricade from whatever you find in the streets. The most useful items are large cardboard boxes you load with bricks, as you can build tall stacks of them.

Given N boxes with positive weight, strength and height build the tallest tower (each item in the tower must have enough strength to bear the sum of the weights of the items above).

   cardboard boxes to build from
http://www.instructables.com/id/Free-Boxes-Free-Waste-Removal/

Input

The first line of the input contains N, the following N lines each contains three integers H,W,S, the height, weight and strength of an item.

Output

The output should give the tallest tower: the first line is the height and the second line the list of items of the tower from the bottom to top (items are indexed from 0 based on their position in the input).

Example input

10
4 3 8
5 2 9
7 1 4
3 2 5
4 1 3
9 4 6
1 1 5
1 3 7
2 2 4
3 2 6

Example output

29
1 5 3 6 2 4