{"raw_statement":[{"iden":"statement","content":"Omar is a very lucky person. One day he found an array of five integers in the middle of the street!\n\nBecause Omar loves pre-calculations, he looked at the numbers and immediately marked the maximum number and the minimum number among them, just in case someone asked him about such information!\n\nThe next day people started asking questions about the array. Most people asked about the maximum number and the minimum number as expected, but one question was beyond all Omar's expectations! The question was: \"what is the maximum number we can get from choosing two distinct numbers from the array, such that their multiplication is as large as possible ?\"\n\nIt's a sure thing that Omar can easily calculate this information, but as everyone knows .. he is a very busy person. Can you help him answering the question?\n\nThe first line of the input contains T the number of test cases.\n\nEach test case is represented with five integers on a single line separated by spaces, the numbers that Omar found. All numbers are positive, distinct integers and less than 1000.\n\nFor each test print one integer. The answer to the question above. \n\n"},{"iden":"input","content":"The first line of the input contains T the number of test cases.Each test case is represented with five integers on a single line separated by spaces, the numbers that Omar found. All numbers are positive, distinct integers and less than 1000."},{"iden":"output","content":"For each test print one integer. The answer to the question above. "}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $ be the number of categories.  \nLet $ K \\in \\mathbb{Z}^+ $ be Nay’s position in the queue.  \nLet $ A = (a_1, a_2, \\dots, a_N) $ be a sequence of non-negative integers representing the prices of jewels in each category.\n\n**Constraints**  \n1. $ 1 \\leq N \\leq 10^5 $  \n2. $ 1 \\leq K \\leq \\binom{N}{2} $  \n3. $ 0 \\leq a_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, N\\} $\n\n**Objective**  \nThe set of all possible distinct pairs of categories is $ \\binom{N}{2} $. Clients select unordered pairs $ \\{i, j\\} $ with $ i \\ne j $, and no pair may be repeated. The cost of selecting pair $ \\{i, j\\} $ is $ a_i + a_j $.  \n\nThe first $ K-1 $ clients will choose the $ K-1 $ cheapest distinct pairs. Nay, as the $ K $-th client, must choose the $ K $-th cheapest distinct pair.  \n\nFind the minimum total cost of the $ K $-th smallest sum $ a_i + a_j $ over all unordered pairs $ \\{i, j\\} $ with $ i < j $.  \n\n$$\n\\text{Answer} = \\text{the } K\\text{-th smallest value in } \\left\\{ a_i + a_j \\mid 1 \\leq i < j \\leq N \\right\\}\n$$","simple_statement":"Nay is the K-th person in line to buy jewelry. Each jewelry category has a price. Each customer must pick two jewels from two different categories, and no two customers can pick the same pair of categories. Find the minimum total cost for Nay to buy two jewels from different categories, given that all previous K-1 customers have already taken K-1 different pairs.","has_page_source":false}