Given the pixel colors a camera recorded of a three-armed spinner, recover the camera's position and rotation angle.
Hard8GeometryBinary searchImplementationMathNo attempts yetTime limit2sMemory limit512 MBFreddy the Flatland photographer wants to write about new toys for the newspaper Flatland Financial Times. He saw a very nice picture of a fidget spinner in the magazine Flatland Weekly, and he likes it so much that he wants to publish the same picture. Flatland copyright law forbids copying the picture, so Freddy decides to take his own picture that looks exactly the same. Help him place his camera.

Photography in Flatland
Freddy owns one 1MP camera and a few cheaper cameras with fewer pixels. One pixel records three real numbers (R,G,B) between 0 and 1 as a colour. In the picture Freddy wants to reproduce, the fidget spinner lies on a fully black (0,0,0) background. Fully black pixels make up at most 40% of the picture. The spinner is never cut off, so the leftmost pixel and the rightmost pixel are always fully black. The arms of the spinner have pure colours, in counter clockwise order red (1,0,0), green (0,1,0) and blue (0,0,1). Every arm has length 1, and two neighbouring arms are separated by the same angle 2π/3, that is 120 degrees. The spinner stands in the Origin Photography Studio with its middle at x=0, y=0 and the tip of its blue arm at x=−1, y=0.

A camera with n pixels and viewing angle θ captures the angle θ in total, so one pixel covers the angle θ/n. The camera sits at position (x,y), and the angle α is the counter clockwise angle between the positive x-axis and the centre of the camera view. The colour of a pixel is the average over the angular range that the pixel covers. Each arm adds its own colour in proportion to the part of that range where the arm is the object closest to the camera. Arms hide each other. Where two arms overlap in the same direction, only the one nearer to the camera is recorded.
The camera in the figure above has n=8 pixels and a viewing angle of θ=80 degrees, so one pixel covers 10 degrees. One pixel of that picture contains both the red arm and the blue arm. Inside that pixel blue covers 6 degrees and red covers 4 degrees, so the pixel records the colour 104⋅(1,0,0)+106⋅(0,0,1)=(0.4,0.0,0.6), a shade of purple.
The first line contains the camera properties: the number of pixels n (8≤n≤106) and the viewing angle θ (2π/8≤θ≤2π/4) in radians.
Each of the next n lines contains three real numbers R, G and B (0≤R,G,B≤1) with R+G+B≤1+10−10. The pixels are given in clockwise order. Every real number in the input has at most 10 digits after the decimal point.
Print x, y and α (0≤α<2π), the position of the camera and its rotation in radians, separated by single spaces. Print all three numbers with exactly four digits after the decimal point.
Exactly one camera placement produces the given picture, and each of the three printed values stays far from a rounding boundary, so the answer is unique.