E. Laser CNC: Boxes

Access to raw materials is limited during the zombie apocalypse, minimizing scrap is an essential part of the design work flow. It is so important that you decide to solve it in software and apply the solution on any design you create.

Your task is to cut out a set of predefined shapes using the smallest bounding box possible. Shapes must not be rotated or scaled.

   a typical input polygon with a hole

Input

The first line contains the number of shapes (integer). The rest of the file describes the parts you need to cut out, in the following format:

Output

The server expects a valid laser cut script, terminated by an end instruction. The sumbission is accepted only if: the pixmap rendered output contains all shapes and the interior of the shapes don't intersect with each other (We will match the shapes to our reference cutouts with a small tolerance).

Scoring

This is a scaled problem, the evaluated score S is the area of the bounding box.

The scaled real score is

SCORE := round(100 * (1 - sqrt(1 - Smin/S)))
Where Smin is the best submission so far.

Example input

2
1
3 100 100 250 280 84 230
1
3 100 100 150 180 184 70

Example output

# offset 0 -69 -94
# offset 1 55 -44
dx=112
dy=579
tx=31
ty=6
pwm=0
bd=2000
dd=2000
start
dx=3684
dy=453
tx=15
ty=136
pwm=1023
start
dx=470
dy=1560
tx=181
ty=186
start
dx=703
dy=586
tx=31
ty=6
start
dx=119
dy=294
tx=155
ty=56
pwm=0
start
dx=478
dy=1338
tx=239
ty=26
pwm=1023
start
dx=1524
dy=471
tx=205
ty=136
start
dx=849
dy=531
tx=155
ty=56
start
pwm=0
start
end