If countOpsation is possible calculate total countOpsation
$ result = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ result += abs ( $ A [ $ i ] [ 0 ] ) ; for ( $ j = 0 ; $ j < $ m ; $ j ++ ) $ result += abs ( $ A [ 0 ] [ $ j ] - $ A [ 0 ] [ 0 ] ) ; return ( $ result ) ; }