Mullin, who is looking for legendary creatures, has stepped into dangerous lands and is…
- User
Mullin, who is looking for legendary creatures, has stepped into dangerous lands and is now stuck in the middle of the Egyptian desert. He was desperate to be saved when suddenly a green dwarf found him! The dwarf tells him that he can either use his magic to transport him home, but only if Mullin solves the following problem for him.
A table n x m n×m is given to you at the intersection of the line i i m and column J j M a i , J a i, j is written How many ways can you choose a natural number for each row and each column so that the number of each house is equal to the product of the number of its row and its column?
Mullin, who has an unparalleled skill in computer olympiad questions, immediately solves the problem and returns to his home with the help of magic. After returning home, he suggests this question for Burnscott's exam. Now it is your duty to solve this problem.
input In the first line, enter two numbers n n and m m stands for the number of rows and columns, respectively. in each of n n next line m m is a number that J j th number in the line i i indicates the number inside the line i i m and column J j is the table. 1 ≤ n , m ≤ 1
000 1≤n,m≤1000
1 ≤ a i , J ≤ 1 0 12 1≤a i, j ≤10 12
output In the only output line, print the answer to the problem.
Sub-issues Constraint score subproblem 1 7 n
m
1 n = m = 1 2 11 a i ≤ 2 a i ≤2 3 45 a i ≤ 1
000 a i ≤1 000 4 37 without additional restrictions Example Sample entry 1 2 3 2 6 6 6 18 18 Plain text Sample output 1 2
- Assistant