{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"题目描述","value":{"format":"PLAIN","content":"小明将一些长度相同的木棍随机切成了很多小段,每一段长度都不超过50。\n现在他想要把这些木棍拼回去,但是他忘记了自己原先拿了多少根木棍,也忘记了它们原先的长度。请你写一个程序帮助他,计算一下原先这些木棍可能的最短长度。\n所有木棍段的长度都大于0。"}},{"title":"输入","value":{"format":"PLAIN","content":"多组输入。\n每组输入的第一行是一个数n,代表总共被切成了n个小段。然后的一行中有n个数,代表每个小段的长度。\n当n为0时代表输入结束。"}},{"title":"输出","value":{"format":"PLAIN","content":"对于每一组数据,输出一个数代表木棍原先可能的最短长度,每组数据一行。"}},{"title":"样例输入","value":{"format":"PLAIN","content":"9\n5 2 1 5 2 1 5 2 1\n4\n1 2 3 4\n0"}},{"title":"样例输出","value":{"format":"PLAIN","content":"6\n5"}}]}