{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eIt\u0027s a starry night and DreamGrid is counting stars. Unfortunately, it becomes cloudy and many stars are hidden from view. DreamGrid wants to go out of the shadow and find a place where at least one star can be seen. He wants to know the total area of the shadow first.\u003c/p\u003e\u003cp\u003eThere are $$$n$$$ stars and $$$m$$$ clouds in the sky. Formally, each star is represented by a point $$$(x_i, y_i) \\ (1 \\le i \\le n)$$$ in a two-dimensional plane. The $$$i$$$-th ($$$1 \\le i \\le m$$$) cloud is represented by a segment $$$(u_{i1},v_{i1})-(u_{i2},v_{i2})$$$, where $$$(u_{i1},v_{i1})$$$ and $$$(u_{i2},v_{i2})$$$ are the two endpoints of the segment. \u003c/p\u003e\u003cp\u003eFor a viewpoint $$$(x, 0)$$$ on the x-axis, DreamGrid considers it to be in shadow if none of the stars can be seen there. A star can be seen at a viewpoint if the segment connecting the viewpoint and the star doesn\u0027t intersect with any cloud (including the endpoints of a cloud). Note that if a cloud (including its endpoints) goes through a star, the star can\u0027t be seen anywhere.\u003c/p\u003e\u003cp\u003eIt\u0027s tiring to go through the whole x-axis and calculate the total shadow area. Can you tell DreamGrid the total area (length) covered by shadow on the x-axis?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input contains multiple cases. The first line of the input contains a single integer $$$T\\ (1 \\le T \\le 500)$$$, the number of cases.\u003c/p\u003e\u003cp\u003eFor each case, the first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\leq n, m \\leq 500$$$), the number of stars and clouds. The following $$$n$$$ lines describe the positions of the stars. The $$$i$$$-th ($$$1 \\le i \\le n$$$) line contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$-10^4 \\le x_i \\le 10^4$$$, $$$1 \\le y_i \\le 10^4$$$), the position of the $$$i$$$-th star. The following $$$m$$$ lines describe the positions of the clouds. The $$$i$$$-th ($$$1 \\le i \\le m$$$) line contains four integers $$$u_{i1},v_{i1},u_{i2},v_{i2}$$$ ($$$-10^4 \\le u_{i1}, u_{i2} \\le 10^4$$$, $$$1 \\le v_{i1},v_{i2} \\le 10^4, (u_{i1},v_{i1}) \\ne (u_{i2},v_{i2})$$$), the positions of the endpoints of the $$$i$$$-th cloud.\u003c/p\u003e\u003cp\u003eIt\u0027s guaranteed that the number of cases where $$$\\max(n,m) \\ge 100$$$ doesn\u0027t exceed $$$5$$$. Please note that multiple stars can be in the same position, and the clouds can intersect and overlap with each other.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each case, print a single line containing a single real number, denoting the total area (length) of shadow on the x-axis. If the answer is larger than $$$10^9$$$, print $$$-1$$$ instead. \u003c/p\u003e\u003cp\u003eYour answer will be accepted if and only if the absolute or relative error does not exceed $$$10^{-4}$$$.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e8\n1 2\n0 3\n-2 1 -1 1\n2 1 1 1\n1 2\n0 3\n-2 1 -1 1\n1 2 2 1\n2 2\n10000 100\n-10000 100\n-10000 50 -3000 50\n10000 50 3000 50\n2 2\n0 3\n-1 10\n3 2 0 1\n0 1 -1 10\n1 1\n0 2\n1 1 3 2\n1 1\n0 10000\n-10000 9999 10000 9999\n1 1\n0 10000\n-9999 9999 9999 9999\n1 1\n0 10000\n-10000 1 9999 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3.0000000000\n1.5000000000\n8000.0000000000\n-1\n-1\n200000000.0000000000\n199980000.0000000000\n20002.0003000500\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eFor the first sample case, the range of the shadow is $$$[-3,-1.5] \\cup [1.5,3]$$$.\u003c/p\u003e\u003cp\u003eFor the fourth sample case, the second star is covered by the second cloud, so it can\u0027t be seen anywhere.\u003c/p\u003e"}}]}