PROGRAM

The final program can be found here.