{"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":"\u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e剧院的舞台是一个由n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e*m个方格组成的长方形。导演给了你一份演员在舞台上表演的计划书。在舞台演出计划书里写着每一个方格是否会有演员。\u003c/p\u003e \n \u003cp\u003e 在演出的时候,你要把聚光灯放一些我们称为“good”的位置上。聚光灯会照向这个格子的四个方向中的一个(如果你在舞台的上方往下看)——上,下,左,右四个方向。我们称聚光灯的朝向为光会照向的方向。\u003c/p\u003e \n \u003cp\u003e \u003cspan\u003e一个被我们称为“good”的位置需要满足以下两个条件:\u003c/span\u003e\u003c/p\u003e \n \u003cul\u003e \n \u003cli\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e在放置聚光灯的方格不能有演员站在那\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \n \u003cli\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e至少有一个演员在聚光灯的朝向上。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \n \u003c/ul\u003e \n \u003cp\u003e 我们需要统计这些被称为“good”的位置的个数。注意,如果两个“good”位置的所处方格不同,或者聚光灯朝向不同,那么我认为这两个“good”位置是不同的。\u003c/p\u003e \n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e第一行包含一个整数n和m\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e(\u003cspan\u003e1 ≤ \u003ci\u003en\u003c/i\u003e, \u003ci\u003em\u003c/i\u003e ≤ 1000\u003c/span\u003e)——\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e行和列的个数\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n \u003cp\u003e 接下来的n行,每行有m个数,描述了该计划书。1代表该方格有演员,0代表该方格没有演员。数据保证,至少有一个演员在舞台上。\u003c/p\u003e \n \u003c/div\u003e \n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e输出一个整数\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e——\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e被称为“good”位置的数量\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n \u003c/div\u003e \n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e \n \u003cdiv\u003e \n \u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003eInput1\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n \u003cp\u003e 2 4\u003cbr\u003e 0 1 0 0\u003cbr\u003e 1 0 1 0\u003c/p\u003e \n \u003c/div\u003e \n \u003cdiv\u003e \n \u003cpre\u003e\r\n\t\t\t\t\u003c/pre\u003e \n \u003c/div\u003e \n \u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003eInput2\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n \u003cp\u003e 4 4\u003cbr\u003e 0 0 0 0\u003cbr\u003e 1 0 0 1\u003cbr\u003e 0 1 1 0\u003cbr\u003e 0 1 0 0\u003c/p\u003e \n \u003c/div\u003e \n \u003cdiv\u003e \n \u003cpre\u003e\r\n\t\t\t\t\u003c/pre\u003e \n \u003c/div\u003e \n \u003c/div\u003e \n \u003c/div\u003e \n\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003eOutput1\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n \u003cp\u003e 9\u003c/p\u003e \n \u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003c/div\u003e \n\u003cdiv\u003e \n \u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003eOutput2\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n \u003cp\u003e 20\u003c/p\u003e \n\u003c/div\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e \n \u003cp\u003e In the first example the following positions are \u003cspan\u003egood\u003c/span\u003e:\u003c/p\u003e \n \u003col\u003e \n \u003cli\u003e the (1, 1) cell and right direction;\u003c/li\u003e \n \u003cli\u003e the (1, 1) cell and down direction;\u003c/li\u003e \n \u003cli\u003e the (1, 3) cell and left direction;\u003c/li\u003e \n \u003cli\u003e the (1, 3) cell and down direction;\u003c/li\u003e \n \u003cli\u003e the (1, 4) cell and left direction;\u003c/li\u003e \n \u003cli\u003e the (2, 2) cell and left direction;\u003c/li\u003e \n \u003cli\u003e the (2, 2) cell and up direction;\u003c/li\u003e \n \u003cli\u003e the (2, 2) and right direction;\u003c/li\u003e \n \u003cli\u003e the (2, 4) cell and left direction.\u003c/li\u003e \n \u003c/ol\u003e \n \u003cp\u003e Therefore, there are \u003cspan\u003e9\u003c/span\u003e \u003cspan\u003egood\u003c/span\u003e positions in this example.\u003c/p\u003e \n \u003c/div\u003e \n\u003c/div\u003e"}}]}