{"raw_statement":[{"iden":"statement","content":"You have N rectangles, all of their sides are either parallel to X axis or to Y axis, and you want to cover them all using one big rectangle. \n\nwhat is the minimum area of the big rectangle you need in order to cover all the rectangles.\n\nThe first line contains number of test cases T \n\nEach test case consists of an integer N (1 ≤ N ≤ 1000), followed by N lines, each line describes a rectangle with four pairs of integers representing the X coordinate and Y coordinate of the vertices.  - 1000 ≤ Xcoordinate, Ycoordinate ≤ 1000\n\nFor each test case print one integer which is the size of the rectangular cover.\n\n"},{"iden":"input","content":"The first line contains number of test cases T Each test case consists of an integer N (1 ≤ N ≤ 1000), followed by N lines, each line describes a rectangle with four pairs of integers representing the X coordinate and Y coordinate of the vertices.  - 1000 ≤ Xcoordinate, Ycoordinate ≤ 1000"},{"iden":"output","content":"For each test case print one integer which is the size of the rectangular cover."},{"iden":"examples","content":"Input211 1 2 2 2 1 1 220 0 10 5 0 5 10 00 1 1 1 1 0 0 0Output150"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, T\\} $:  \n- Let $ N_k \\in \\mathbb{Z} $ denote the size of the array.  \n- Let $ A_k = (a_{k,1}, a_{k,2}, \\dots, a_{k,N_k}) $ be a sequence of non-negative integers.  \n\n**Constraints**  \n1. $ 1 \\le T \\le 20 $  \n2. For each $ k \\in \\{1, \\dots, T\\} $:  \n   - $ 1 \\le N_k \\le 10^5 $  \n   - $ 0 \\le a_{k,i} \\le 10^9 $ for all $ i \\in \\{1, \\dots, N_k\\} $  \n\n**Objective**  \nFind the minimum number of adjacent merge operations required to transform $ A_k $ into a *mirror array* (i.e., $ b_i = b_{m+1-i} $ for all $ i $, where $ m $ is the final length), where a merge operation replaces two adjacent elements $ x, y $ with $ x + y $.","simple_statement":"You are given an array. You can merge two adjacent elements by replacing them with their sum.  \nFind the minimum number of merges needed to make the array read the same forwards and backwards (a mirror).","has_page_source":false}