{"trustable":true,"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":"\r\n\u003csection\u003e\r\n\u003cp\u003eJoisino is planning to open a shop in a shopping street.\u003c/p\u003e\r\n\u003cp\u003eEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\u003c/p\u003e\r\n\u003cp\u003eThere are already \u003cvar\u003e\\(N\\)\u003c/var\u003e stores in the street, numbered \u003cvar\u003e\\(1\\)\u003c/var\u003e through \u003cvar\u003e\\(N\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eYou are given information of the business hours of those shops, \u003cvar\u003e\\(F_{i,j,k}\\)\u003c/var\u003e. If \u003cvar\u003e\\(F_{i,j,k}\u003d1\\)\u003c/var\u003e, Shop \u003cvar\u003e\\(i\\)\u003c/var\u003e is open during Period \u003cvar\u003e\\(k\\)\u003c/var\u003e on Day \u003cvar\u003e\\(j\\)\u003c/var\u003e (this notation is explained below); if \u003cvar\u003e\\(F_{i,j,k}\u003d0\\)\u003c/var\u003e, Shop \u003cvar\u003e\\(i\\)\u003c/var\u003e is closed during that period. Here, the days of the week are denoted as follows. Monday: Day \u003cvar\u003e\\(1\\)\u003c/var\u003e, Tuesday: Day \u003cvar\u003e\\(2\\)\u003c/var\u003e, Wednesday: Day \u003cvar\u003e\\(3\\)\u003c/var\u003e, Thursday: Day \u003cvar\u003e\\(4\\)\u003c/var\u003e, Friday: Day \u003cvar\u003e\\(5\\)\u003c/var\u003e. Also, the morning is denoted as Period \u003cvar\u003e\\(1\\)\u003c/var\u003e, and the afternoon is denoted as Period \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eLet \u003cvar\u003e\\(c_i\\)\u003c/var\u003e be the number of periods during which both Shop \u003cvar\u003e\\(i\\)\u003c/var\u003e and Joisino\u0027s shop are open. Then, the profit of Joisino\u0027s shop will be \u003cvar\u003e\\(P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eFind the maximum possible profit of Joisino\u0027s shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1≤N≤100\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(0≤F_{i,j,k}≤1\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eFor every integer \u003cvar\u003e\\(i\\)\u003c/var\u003e such that \u003cvar\u003e\\(1≤i≤N\\)\u003c/var\u003e, there exists at least one pair \u003cvar\u003e\\((j,k)\\)\u003c/var\u003e such that \u003cvar\u003e\\(F_{i,j,k}\u003d1\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(-10^7≤P_{i,j}≤10^7\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eAll input values are integers.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(F_{1,1,1}\\)\u003c/var\u003e \u003cvar\u003e\\(F_{1,1,2}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(F_{1,5,1}\\)\u003c/var\u003e \u003cvar\u003e\\(F_{1,5,2}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(F_{N,1,1}\\)\u003c/var\u003e \u003cvar\u003e\\(F_{N,1,2}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(F_{N,5,1}\\)\u003c/var\u003e \u003cvar\u003e\\(F_{N,5,2}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(P_{1,0}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(P_{1,10}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(P_{N,0}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(P_{N,10}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the maximum possible profit of Joisino\u0027s shop.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"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\u003e1\r\n1 1 0 1 0 0 0 1 0 1\r\n3 4 5 6 7 8 9 -2 -3 4 -2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eIf her shop is open only during the periods when Shop \u003cvar\u003e\\(1\\)\u003c/var\u003e is opened, the profit will be \u003cvar\u003e\\(8\\)\u003c/var\u003e, which is the maximum possible profit.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"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\u003e2\r\n1 1 1 1 1 0 0 0 0 0\r\n0 0 0 0 0 1 1 1 1 1\r\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\r\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eNote that a shop must be open during at least one period, and the profit may be negative.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"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\u003e3\r\n1 1 1 1 1 1 0 0 1 1\r\n0 1 0 1 1 1 1 0 1 0\r\n1 0 1 1 0 1 0 1 0 1\r\n-8 6 -2 -8 -8 4 8 7 -6 2 2\r\n-9 2 0 1 7 -5 0 -2 -6 5 5\r\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e23\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}