{"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":"Problem Statement","value":{"format":"HTML","content":"\u003csection\u003e \n \u003cp\u003eEid-ul-Azha vacation will start this week. You are making plans about what problems you are going to solve in this vacation. Each problem you solve gives you points of happiness.\u003c/p\u003e \n \u003cp\u003eThe vacation consists of \u003cvar\u003e\\(N\\)\u003c/var\u003e days. For each \u003cvar\u003e\\(i\\)\u003c/var\u003e (\u003cvar\u003e\\(1 \\leq i \\leq N\\)\u003c/var\u003e), you will choose one of the following topics and practice it on the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th day:\u003c/p\u003e \n \u003cul\u003e \n \u003cli\u003eA: Dynamic Programming. Gain \u003cvar\u003e\\(a_i\\)\u003c/var\u003e points of happiness.\u003c/li\u003e \n \u003cli\u003eB: Graph Theory. Gain \u003cvar\u003e\\(b_i\\)\u003c/var\u003e points of happiness.\u003c/li\u003e \n \u003cli\u003eC: Math. Gain \u003cvar\u003e\\(c_i\\)\u003c/var\u003e points of happiness.\u003c/li\u003e \n \u003c/ul\u003e \n \u003cp\u003eAs you get bored easily, you cannot practice the same topic for two or more consecutive days.\u003c/p\u003e \n \u003cp\u003eFind the maximum possible total points of happiness that you can gain.\u003c/p\u003e \n\u003c/section\u003e"}},{"title":"Constraints","value":{"format":"HTML","content":"\u003csection\u003e \n \u003cul\u003e \n \u003cli\u003eAll values in input are integers.\u003c/li\u003e \n \u003cli\u003e\u003cvar\u003e\\(1 \\leq N \\leq 10^5\\)\u003c/var\u003e\u003c/li\u003e \n \u003cli\u003e\u003cvar\u003e\\(1 \\leq a_i, b_i, c_i \\leq 10^4\\)\u003c/var\u003e\u003c/li\u003e \n \u003c/ul\u003e \n\u003c/section\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003csection\u003e \n \u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e \n \u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\n\u003cvar\u003e\\(a_1\\)\u003c/var\u003e \u003cvar\u003e\\(b_1\\)\u003c/var\u003e \u003cvar\u003e\\(c_1\\)\u003c/var\u003e\n\u003cvar\u003e\\(a_2\\)\u003c/var\u003e \u003cvar\u003e\\(b_2\\)\u003c/var\u003e \u003cvar\u003e\\(c_2\\)\u003c/var\u003e\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\n\u003cvar\u003e\\(a_N\\)\u003c/var\u003e \u003cvar\u003e\\(b_N\\)\u003c/var\u003e \u003cvar\u003e\\(c_N\\)\u003c/var\u003e\n\u003c/pre\u003e \n\u003c/section\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003csection\u003e \n \u003cp\u003ePrint the maximum possible total points of happiness that you can gain.\u003c/p\u003e \n\u003c/section\u003e"}},{"title":"Sample 1","value":{"format":"HTML","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\u003e3\n10 40 70\n20 50 80\n30 60 90\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e210\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e \n\u003c/section\u003e\u003csection\u003e \n \u003cp\u003eIf you practice topics in the order C, B, C, you will gain \u003cvar\u003e\\(70 + 50 + 90 \u003d 210\\)\u003c/var\u003e points of happiness.\u003c/p\u003e \n\u003c/section\u003e"}},{"title":"Sample 2","value":{"format":"HTML","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\u003e1\n100 10 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e100\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e \n\u003c/section\u003e\u003csection\u003e \n\u003c/section\u003e"}},{"title":"Sample 3","value":{"format":"HTML","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\u003e7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e46\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e \n\u003c/section\u003e\u003csection\u003e \n \u003cp\u003eYou should practice topics in the order C, A, B, A, C, B, A.\u003c/p\u003e\n\u003c/section\u003e"}}]}