{"trustable":true,"sections":[{"title":"Problem Description","value":{"format":"MD","content":"There are $n$ piles of stones arranged around a circular playground, and we need to merge the stones into one pile in an orderly manner. It is stipulated that only two adjacent piles can be merged into a new pile at a time, and the number of stones in the new pile is recorded as the score for that merge.\n\nPlease write a program that reads the number of piles $n$ and the number of stones in each pile, and performs the following calculations:\n\n1. Choose a merging scheme such that the total score from $n-1$ merges is maximized.\n2. Choose a merging scheme such that the total score from $n-1$ merges is minimized."}},{"title":"Input Format","value":{"format":"MD","content":"The first line contains an integer $n$, indicating there are $n$ piles of stones.\n\nThe second line contains $n$ integers, representing the number of stones in each pile."}},{"title":"Output Format","value":{"format":"MD","content":"The output consists of two lines:\n\nThe first line is the minimum total score from merging,\n\nThe second line is the maximum total score from merging."}},{"title":"Sample","value":{"format":"MD","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\u003e4\n4 5 9 4\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e43\n54\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Data Range and Hints","value":{"format":"MD","content":"For the data of $100\\%$, there are $1\\le n \\le 200$."}}]}