{"raw_statement":[{"iden":"statement","content":"Polycarp does experiments again. He has N triangle heat exchangers on the field. Each i-th heat exchanger has input and output and their coefficients kini and kouti respectively. If two heat exchangers intersect (or first one touches second one), then thir inputs becamee molten together and their input coefficient became k, where , k1 and k2 are input coefficients of heat exchangers. Each point of field emits heat, heat comes out with specific speed. If this point is beneath some heat exchangers, it's value is multiplied by final value of their input coefficient and then it's multiplied by their output coefficients. Square of field with sides's length 1 emits 1 unit of heat. Polycarp wants to know value of heat per second, which emits all heat exchangers.\n\nThe first line contains N, 1 ≤ N ≤ 10. N lines follow, each containing x1i, y1i, x2i, y2i, x3i, y3i, kini, kouti — coordinates of vertexes i-th heat exchanger, input and output coefficients. All numbers are separated by space, coordinates are integers, which are lesser than 101 and greater than  - 101, 0.1 ≤ kini, kouti ≤ 2.0. Triangles are not degenerate.\n\nOutput summary value of heat per second, which emits all heat exchangers. You may assume that answers is coparated with the precision of 10 - 4. \n\n"},{"iden":"input","content":"The first line contains N, 1 ≤ N ≤ 10. N lines follow, each containing x1i, y1i, x2i, y2i, x3i, y3i, kini, kouti — coordinates of vertexes i-th heat exchanger, input and output coefficients. All numbers are separated by space, coordinates are integers, which are lesser than 101 and greater than  - 101, 0.1 ≤ kini, kouti ≤ 2.0. Triangles are not degenerate."},{"iden":"output","content":"Output summary value of heat per second, which emits all heat exchangers. You may assume that answers is coparated with the precision of 10 - 4. "},{"iden":"examples","content":"Input20 0 4 4 8 0 1 11 3 7 3 4 -1 1 1Output9.51785700Input2-100 100 -100 -100 75 -100 0.5 2100 100 100 -100 -75 -100 0.5 2Output17500.00000000"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ N \\in \\mathbb{Z} $, $ 1 \\leq N \\leq 10 $, be the number of triangular heat exchangers.  \nFor each $ i \\in \\{1, \\dots, N\\} $:  \n- Let $ T_i \\subset \\mathbb{R}^2 $ be a non-degenerate triangle with vertices $ (x_{i1}, y_{i1}), (x_{i2}, y_{i2}), (x_{i3}, y_{i3}) $.  \n- Let $ k_{\\text{in},i} \\in \\mathbb{R} $, $ 0.1 \\leq k_{\\text{in},i} \\leq 2.0 $, be the input coefficient.  \n- Let $ k_{\\text{out},i} \\in \\mathbb{R} $, $ 0.1 \\leq k_{\\text{out},i} \\leq 2.0 $, be the output coefficient.  \n\nLet $ \\mathcal{I} \\subseteq \\{1, \\dots, N\\} $ be a maximal set of mutually intersecting (including touching) triangles.  \nFor each such $ \\mathcal{I} $, define the merged input coefficient:  \n$$\nk_{\\text{in}}^{\\mathcal{I}} = \\prod_{i \\in \\mathcal{I}} k_{\\text{in},i}\n$$  \nEach triangle $ i \\in \\mathcal{I} $ contributes output coefficient $ k_{\\text{out},i} $ independently.  \n\nLet $ A_i = \\text{Area}(T_i) $ be the area of triangle $ T_i $.  \nLet $ \\mathcal{P} \\subset \\mathbb{R}^2 $ be the union of all triangles $ T_i $, $ i = 1, \\dots, N $.  \n\n**Constraints**  \n1. Coordinates are integers: $ -100 < x_{ij}, y_{ij} < 100 $.  \n2. Triangles are non-degenerate.  \n3. Heat emission rate per unit area is 1 unit per second on the base field.  \n\n**Objective**  \nCompute the total heat emission per second:  \n$$\nH = \\sum_{\\mathcal{I} \\in \\mathcal{C}} \\left( k_{\\text{in}}^{\\mathcal{I}} \\cdot \\sum_{i \\in \\mathcal{I}} k_{\\text{out},i} \\cdot A_i \\right)\n$$  \nwhere $ \\mathcal{C} $ is the set of all connected components (maximal intersecting groups) of triangles.","simple_statement":"Polycarp has N triangular heat exchangers. Each triangle has 3 vertices and two coefficients: k_in (input) and k_out (output).  \n\nWhen two triangles overlap or touch, their input coefficients combine into a single value.  \n\nEach point on the ground emits 1 unit of heat per second. If a point is under a triangle, the heat is multiplied by the triangle’s final input coefficient, then by its output coefficient.  \n\nFind the total heat emitted per second by all triangles combined.  \n\nInput: N, then N lines with 3 vertex coordinates (x,y), k_in, k_out.  \nOutput: Total heat with precision 10^-4.","has_page_source":false}