Alfred Pennyworth is Batman's loyal butler. As such, whenever Batman returns to the Batcave wounded, it is Alfred's job to tend to him. Most of the time, Batman's problems can be fixed with just a few stitches, and Alfred is a master at needlework. After one especially bloody night, the Dark Knight returns home, severely wounded. Normally, Alfred would easily be able to stitch up the wounds, but that very night was the night that the Riddler decided to cut off the power in all of Gotham. Alfred has asked you, Captain Nightvision, with your super powerful night vision, to guide him in his stitching. Given Batman's wounds as a grid, give Alfred directions to close up the wound.
Batman's wounds appear as a grid of the characters
X representing the points that Alfred's needle must pass through. Starting from the left most stitch point and going to the right, you must tell Alfred at what angle to make each stitch in order to reach the next point that Alfred's needle must pass through.
The first line of input will contain two integers, ~R~ and ~C~ ~(1 \le R,C \le 10^4)~.
The next ~R~ lines will contain ~C~ characters, mapping out Batman's wound. It is guaranteed that there will be a maximum of one
X per column.
Output the angle of each stitch, starting for the center of each
X, clockwise from the north bearing in degrees, precise to 3 decimal places.
If no angles exist, output
3 6 XOOOXO OOXOOO OXOOOX
153.435 45.000 63.435 153.435
The order in which the stitches are made is:
1OOO4O OO3OOO O2OOO5
For the first 2 points, the angle is found like so:
This is continued for every pair of consecutive points.