D. Laser CNC - Cover

The second layer of your software is a CAD system that can design a cutout of the specified shape. The shape is not specified precisely, but as a set of areas which should or should not be covered by the cutout. This task is common for building 3D objects by slicing them in layers that are cut out one by one and then stacked. Since this process is very time consuming, you will need to optimize your cut script for speed.

You need to provide a script that cuts out polygons in a way that the pixmap rendered cutouts will cover all green pixels but never cover any red pixel of the input. The script is fed into the simulator and the resulting png is flood-filled with blue starting from the middle from a large green area.

   example red-green shape

The submission is not accepted if the filled cutout does not have a blue pixel over any green pixel, or has blue pixel over any red pixel, or there are some components that are only connected with narrow stripes (this is checked by scaling down each side of the pixmap to 25% and the cutout should be still fully connected).

Input

Input is a png containing black (#000000), green (#00ff00) and red (#ff0000) pixels. Black pixels are neutral (does not matter what the rendered png has over them).

Output

Output is a laser script with the lowest possible runtime that meets all requirements.

Example input

Provided as input 0.png.

Example output

See in 0.out, next to 0.png.