Company: MediaNet_7july
Difficulty: medium
GOAT-master Pass-code Problem Description GOAT-master got arrested in a police chase. He is trying to escape the high-tech prison he is held captive in. He needs a pass-code P for disabling all the cameras in order to escape. Pass-code is the solution of matrix problem given below. Help him finding the pass-code. You are given a matrix of order N×N. Each cell in a matrix has a value A[i][j] (1 Cells which are not blocked have distinct values. You can traverse from a cell in any direction (up, down, left or right), if there is no blockage. For any cell A[i][j], sed-value S ij is defined as sum of values of cells A[x][y] which are multiple of A[i][j], but not reachable from A[i][j]. For blocked cells, sed-value is -1. Pass-code P is sum of sed-values of all the cells, modulo 1000000007. Constraints 1 3 1 6 A[i][j] = -1 for blocked cells only Input Format First argument is a 2-D array of integers denoting the above matrix. Output Format Return the sum of sed-values of all the cells, modul