{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n .markdown img {\n max-width: 900px;\n display: block;\n margin: 10px auto;\n }\n .markdown code {\n display: inline-block;\n padding: 0 4px;\n margin: 0;\n background-color: rgba(0, 0, 0, 0.04);\n border-radius: 3px;\n font-weight: bold;\n }\n .markdown pre code {\n display: block;\n padding: 20px;\n font-weight: normal;\n }\n .markdown table {\n width: 100%;\n table-layout: fixed;\n border-collapse: collapse;\n }\n .markdown table th {\n font-size: 13px;\n text-align: left;\n padding: 10px;\n border: 1px solid #e0e0e0;\n background: #f1f1f1;\n }\n .markdown table td {\n font-size: 14px;\n padding: 5px 10px;\n border: 1px solid #e0e0e0;\n }\n .markdown-form-widget .markdown-notice p {\n padding: 0;\n margin: 0;\n color: #999999;\n font-size: 11px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"markdown texable\"\u003e\u003cp\u003eThe chessboard of size \u003cstrong\u003en\u003c/strong\u003e × \u003cstrong\u003em\u003c/strong\u003e is given. Each its cell contains a positive integer. The turtle sits in the upper left corner. The turtle can make knight moves down and right. That is, it can move either one step to the right and two steps down, or one step down and two steps to the right. Help the turtle to reach the lower right corner of the board, collecting the maximum sum of numbers. The turtle collects only those numbers, where it finishes its moves, but not all where it creeps.\u003c/p\u003e\u003ch4\u003eInput\u003c/h4\u003e\u003cp\u003eFirst line contains two integers \u003cstrong\u003en\u003c/strong\u003e and \u003cstrong\u003em\u003c/strong\u003e (\u003cstrong\u003e1\u003c/strong\u003e ≤ \u003cstrong\u003en\u003c/strong\u003e, \u003cstrong\u003em\u003c/strong\u003e ≤ \u003cstrong\u003e100\u003c/strong\u003e) giving the size of the board. Then given numbers written on the board - \u003cstrong\u003en\u003c/strong\u003e rows each containing \u003cstrong\u003em\u003c/strong\u003e positive integers, not greater than \u003cstrong\u003e10000\u003c/strong\u003e.\u003c/p\u003e\u003ch4\u003eOutput\u003c/h4\u003e\u003cp\u003ePrint the desired maximum sum , or \u003cstrong\u003e-1\u003c/strong\u003e if the turtle can\u0027t reach the lower right corner.\u003c/p\u003e\u003c/div\u003e"}},{"title":"Example","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\u003e2 3\n3 2 7\n1 9 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}