CF598F Cut Length
Description
Given simple (without self-intersections) $ n $ -gon. It is not necessary convex. Also you are given $ m $ lines. For each line find the length of common part of the line and the $ n $ -gon.
The boundary of $ n $ -gon belongs to polygon. It is possible that $ n $ -gon contains 180-degree angles.
Input Format
The first line contains integers $ n $ and $ m $ ( $ 3
Output Format
Print $ m $ lines, the $ i $ -th line should contain the length of common part of the given $ n $ -gon and the $ i $ -th line. The answer will be considered correct if the absolute or relative error doesn't exceed $ 10^{-6} $ .