Get the left column sum
if ( i == 0 ) : NEW_LINE INDENT col_s = 0 NEW_LINE DEDENT else : NEW_LINE INDENT col_s = col [ i - 1 ] [ j ] NEW_LINE DEDENT upper_row = row [ i ] [ j + k ] - row_s NEW_LINE left_col = col [ i + k ] [ j ] - col_s NEW_LINE