{"extraResources":{"example.01.mu":"TVXzATINCjEwIDIzOQ0K","example.02.mu":"TVXzATMNCjEgMiAyDQo="},"scoring":null,"notes":"","legend":"In a wonderful land where the sun shines brighter and flowers grow more lushly, there lived a kind gardener named Nikolay. He eagerly awaited the time to open the gardening season and engage in his favorite activity: cultivating garden beds.\r\n\r\nOne day, gathering his strength, Nikolay brought a few magical pairs of boards with him. Boards from the same pair had the same length, whereas boards from different pairs may have had different lengths. Nikolay dreamed of creating a \\textit{beautiful} rectangular garden bed where the prettiest vegetables and flowers would grow. For that, he needed to use all his boards without cutting them, placing paired boards on the opposite sides of the rectangle.\r\n\r\nAnd so, standing in front of his garden, Nikolay pondered: ``What can be the area of a beautiful garden bed?'' Help him determine the minimum and maximum positive area he could obtain.\r\n","authorLogin":"Olympic_Bear","language":"english","timeLimit":1000,"output":"Output two integers: the minimum and maximum area of a beautiful garden bed.\r\n","inputFile":"stdin","outputFile":"stdout","input":"The first line contains an integer $n$: the number of pairs of boards ($2 \\le n \\le 7$).\r\n\r\nThe second line contains $n$ integers: the lengths of boards in the first, second, \\ldots, $n$-th pair.\r\nEach length is an integer from $1$ to $10^8$.","authorName":"Nikolay Dubchuk","sampleTests":[{"output":"2390 2390\r\n","input":"2\r\n10 239\r\n","inputFile":"example.01","outputFile":"example.01.a"},{"output":"4 6\r\n","input":"3\r\n1 2 2\r\n","inputFile":"example.02","outputFile":"example.02.a"}],"name":"Garden Bed","interaction":null,"memoryLimit":1073741824,"tutorial":"Solution --- for the minimum area, multiply the smallest board size by the sum of all the others, and for the maximum --- solve the knapsack problem (selecting boards so that the dimensions are closer to a square). It can be solved by complete enumeration."}