시간 제한메모리 제한제출정답맞은 사람정답 비율
0.5 초 (추가 시간 없음) 1024 MB1401039281.416%

문제

A real estate company IC is managing a rectangular section of land. The section is divided into $mn$ segments in $m \times n$ matrix shape, where the number of rows and that of columns are $m$ and $n$, respectively. Each segment has its own price as a positive integer. IC wants to sell a rectangular subsection of the land, but the price of the subsection should be ten. The price of a subsection is simply the sum of the prices of the segments in the subsection. Since there can be several such subsections, IC wants to identify the number of candidate subsections to sell. Write a program to help IC, counting the number of candidate subsections of the land.

For example, the prices of segments of the land having $5 \times 7$ segments are given as follows:

We can find four candidate subsections to sell marked by rectangles: the first one consists of four segments in the first and the second rows spanning over from the second to the third columns, the second, six segments in the second and the third rows spanning over from the third to the fifth columns, the third, two segments in the first row spanning over from the fifth to the sixth columns, and the fourth, three segments in the seventh column spanning over from the third to the fifth rows. Therefore, your program should report four for the above input.

입력

Your program is to read from standard input. The input starts with two positive integers $m$ and $n$ ($1 \le m, n \le 300$), denoting the dimensions of the land, which are given separated by a space. Each of the following $m$ lines contains $n$ positive integers $p_{ij}$ representing the prices of the segments of the $i$-th row of the land ($1 \le i \le m$, $1 \le j \le n$, and $1 \le p_{ij} \le 10$). The prices are also separated by a space.

출력

Your program is to write to standard output. Print exactly one line containing an integer representing the number of rectangular subsections with the price of ten.

예제 입력 1

3 5
3 1 2 1 4
4 5 2 2 2
4 7 1 1 2

예제 출력 1

2

예제 입력 2

4 6
3 1 2 1 4 6
4 5 2 2 2 7
4 7 1 1 1 9
4 3 3 3 7 2

예제 출력 2

8