Given an Matrix where each integer appears exactly once in . Let the value of a submatrix of as the greatest common divisor (GCD) of all the entries among the submatrix, you need to determine the sum of the values for all continuous submatrices of .
输入描述:
The first line contains two integers and . Following lines each contains integers , denoting the given matrix. It is guaranteed that each integer appears exactly once in .
输出描述:
Output one line containing one integer, denoting the answer.