Initialize first width - First column of tSum array
for ( k = 1 ; k < n ; k ++ ) for ( j = 1 ; j < m ; j ++ ) tSum [ 0 , j , k ] = min ( tSum [ 0 , j , k - 1 ] , tSum [ 0 , j - 1 , k ] , int . MaxValue ) + arr [ 0 , j , k ] ;