{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003edqhl76最近在玩一个游戏,他会给你一个长度为n的序列,序列中的元素为ai。他需要你对序列中的元素进行n-1次合并操作,每次合并操作你可以选择序列中的了两个相邻的元素,将a[x]和a[x+1]合并成一个元素值为$$$(a[x]*a[x+1])mod1000003$$$并且得到$$$(a[x]-a[x+1])^2$$$分。你将一直持续这个游戏,知道序列只剩下一个元素为止。\u003c/p\u003e\n\u003cp\u003e现在dqhl76想问你你能获得的最大积分是多少。\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e第一行一个整数n表示序列的长度$$$1\u003c\u003dn\u003c\u003d300$$$\u003c/p\u003e\n\u003cp\u003eT接下来一行n个整数,a[1],a[2],a[3]....a[n]$$$1\u003c\u003dai\u003c\u003d10^6$$$\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e一个整数,表示你能达到的最大积分。\u003c/p\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4\n1 2 3 4\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e630\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}