The country of JOI is a rectangle divided into a grid of H rows and W columns. The vertical direction of JOI is parallel to the north-south axis, and the horizontal direction is parallel to the east-west axis. The population of the cell in the i-th row from the north (1 ≦ i ≦ H) and the j-th column from the west (1 ≦ j ≦ W) is Ai,j people.
To improve administrative efficiency, JOI has decided to divide the entire country into two or more districts by drawing one or more boundary lines that satisfy the following conditions.
Given the population of each cell in JOI, write a program that calculates the number of ways to divide the country such that the population of every district is equal.
The input is given from standard input in the following format.
H W
A1,1 A1,2 … A1,W
A2,1 A2,2 … A2,W
:
AH,1 AH,2 … AH,W
Output the number of ways to divide the country such that the population of every district is equal, in one line to standard output.
2 3 10 10 20 10 10 20
3
As shown in the figures below, there are 3 ways to divide the country such that the population of every district is equal, so output 3.
1 4 2 1 1 2
2
As shown in the figures below, there are 2 ways to divide the country such that the population of every district is equal, so output 2.
3 3 2 9 4 7 5 3 6 1 8
2
As shown in the figures below, there are 2 ways to divide the country such that the population of every district is equal, so output 2.
1 1 10000
0
There is no way to divide the country such that the population of every district is equal, so output 0.
Japan Information Olympiad Committee, "21st Japan Information Olympiad JOI 2021/2022 Second Preliminary Round Problem"