{"raw_statement":[{"iden":"problem statement","content":"There is a grass field that stretches infinitely.\nIn this field, there is a negligibly small cow. Let $(x, y)$ denote the point that is $x\\ \\mathrm{cm}$ south and $y\\ \\mathrm{cm}$ east of the point where the cow stands now. The cow itself is standing at $(0, 0)$.\nThere are also $N$ north-south lines and $M$ east-west lines drawn on the field. The $i$\\-th north-south line is the segment connecting the points $(A_i, C_i)$ and $(B_i, C_i)$, and the $j$\\-th east-west line is the segment connecting the points $(D_j, E_j)$ and $(D_j, F_j)$.\nWhat is the area of the region the cow can reach when it can move around as long as it does not cross the segments (including the endpoints)? If this area is infinite, print `INF` instead."},{"iden":"constraints","content":"*   All values in input are integers between $-10^9$ and $10^9$ (inclusive).\n*   $1 \\leq N, M \\leq 1000$\n*   $A_i < B_i\\ (1 \\leq i \\leq N)$\n*   $E_j < F_j\\ (1 \\leq j \\leq M)$\n*   The point $(0, 0)$ does not lie on any of the given segments."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$ $C_1$\n$:$\n$A_N$ $B_N$ $C_N$\n$D_1$ $E_1$ $F_1$\n$:$\n$D_M$ $E_M$ $F_M$"},{"iden":"sample input 1","content":"5 6\n1 2 0\n0 1 1\n0 2 2\n-3 4 -1\n-2 6 3\n1 0 1\n0 1 2\n2 0 2\n-1 -4 5\n3 -2 4\n1 2 4"},{"iden":"sample output 1","content":"13\n\nThe area of the region the cow can reach is $13\\ \\mathrm{cm^2}$.\n![image](https://img.atcoder.jp/abc168/education.png)"},{"iden":"sample input 2","content":"6 1\n-3 -1 -2\n-3 -1 1\n-2 -1 2\n1 4 -2\n1 4 -1\n1 4 1\n3 1 4"},{"iden":"sample output 2","content":"INF\n\nThe area of the region the cow can reach is infinite."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}