{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"MD","content":"今天是中秋節,吳剛想停下砍樹的工作稍微休息一會。\n\n吳剛決定休息 ***n*** 小時,在這 ***n*** 小時中,他只會進行以下這三個活動,且每小時只做同一件事:看電影、睡覺、寫程式。吳剛覺得在不同的時間點適合做的事情也不相同,因此每個小時吳剛對這三項活動的滿意程度也不同,在第 ***i*** 個小時中,看電影能給吳剛 ***m\u003csub\u003ei\u003c/sub\u003e*** 的滿足度、睡覺則為 ***s\u003csub\u003ei\u003c/sub\u003e*** ,而寫程式為 ***p\u003csub\u003ei\u003c/sub\u003e***。吳剛覺得連續兩小時做同一件事太無趣了,所以他也不會連續兩小時做同樣的事情。\n\n請你告訴吳剛,在這 ***n*** 小時中,他最高能達到的總滿意度是多少?"}},{"title":"Input","value":{"format":"MD","content":"輸入的第一行包含一整數 ***n*** (1 ≤ ***n*** ≤ 10\u003csup\u003e5\u003c/sup\u003e)。\n\n接下來 ***n*** 行,每行包含三個由空白隔開的整數 ***s\u003csub\u003ei\u003c/sub\u003e***, ***m\u003csub\u003ei\u003c/sub\u003e***, ***p\u003csub\u003ei\u003c/sub\u003e*** (1 ≤ ***s\u003csub\u003ei\u003c/sub\u003e***, ***m\u003csub\u003ei\u003c/sub\u003e***, ***p\u003csub\u003ei\u003c/sub\u003e*** ≤ 10\u003csup\u003e4\u003c/sup\u003e)。"}},{"title":"Output","value":{"format":"MD","content":"輸出一整數,為吳剛能達到的最高總滿意度。"}},{"title":"Sample Input 1","value":{"format":"MD","content":"```\n3\n10 40 70\n20 50 80\n30 60 90\n```"}},{"title":"Sample Output 1","value":{"format":"MD","content":"```\n210\n```"}},{"title":"Sample Input 2","value":{"format":"MD","content":"```\n1\n100 10 1\n```"}},{"title":"Sample Output 2","value":{"format":"MD","content":"```\n100\n```"}}]}