Problem C: [GESP202503 四级] 二阶矩阵

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:11 Solved:9

Description

小 A 有一个  行  列的矩阵 

小 A 认为一个  的矩阵  是好的,当且仅当 。其中  表示矩阵  的第  行第  列的元素。

小 A 想知道  中有多少个好的子矩阵。

Input

第一行,两个正整数 

接下来  行,每行  个整数 

Output

一行,一个整数,表示  中好的子矩阵的数量。

Sample Input Copy

3 4
1 2 1 0
2 4 2 1
0 3 3 0

Sample Output Copy

2