

import os





def  _snake_case		()							->		Tuple:
  __UpperCAmelCase	:  int		=     os.path.dirname(os.path.realpath(__A  )  )
  __UpperCAmelCase	:  Tuple		=     os.path.join(__A    ,       'triangle.txt'  )

  with open(__A  ) as f:
    __UpperCAmelCase	:  str		=     f.readlines()

  __UpperCAmelCase	:  Tuple		=     [[int(__A  ) for y in x.rstrip('\r\n'  ).split(' '  )] for x in triangle]

  for i in range(1    ,       len(__A  )  ):
    for j in range(len(a[i]  )  ):
      __UpperCAmelCase	:  Dict		=     a[i - 1][j] if j != len(a[i - 1]  ) else 0
      __UpperCAmelCase	:  List[str]		=     a[i - 1][j - 1] if j > 0 else 0
      a[i][j] += max(__A    ,       __A  )
  return max(a[-1]  )


if __name__ == "__main__":
      print(solution())








def 				__a							(       __A			,							__A			,							__A			,							__A						):
    return len_board * len_board_column * row + column





def 				__a							(       __A			,							__A			,							__A			,							__A			,							__A			,							__A			,							):

    if board[row][column] != word[word_index]:
        return False

    if word_index == len(__A						) - 1:
        return True

    SCREAMING_SNAKE_CASE__         =    [(0, 1), (0, -1), (-1, 0), (1, 0)]
    SCREAMING_SNAKE_CASE__         =    len(__A						)
    SCREAMING_SNAKE_CASE__         =    len(board[0]						)
    for direction in traverts_directions:
        SCREAMING_SNAKE_CASE__         =    row + direction[0]
        SCREAMING_SNAKE_CASE__         =    column + direction[1]
        if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
            continue

        SCREAMING_SNAKE_CASE__         =    get_point_key(__A			,							__A			,							__A			,							__A						)
        if key in visited_points_set:
            continue

        visited_points_set.add(__A						)
        if exits_word(__A			,							__A			,							__A			,							__A			,							word_index + 1			,							__A						):
            return True

        visited_points_set.remove(__A						)

    return False





def 				__a							(       __A			,							__A						):
    SCREAMING_SNAKE_CASE__         =    (
        "The board should be a non empty matrix of single chars strings."
    )

    SCREAMING_SNAKE_CASE__         =    len(__A						)
    if not isinstance(__A			,							__A						) or len(__A						) == 0:
        raise ValueError(__A						)

    for row in board:
        if not isinstance(__A			,							__A						) or len(__A						) == 0:
            raise ValueError(__A						)

        for item in row:
            if not isinstance(__A			,							__A						) or len(__A						) != 1:
                raise ValueError(__A						)

    # Validate word
    if not isinstance(__A			,							__A						) or len(__A						) == 0:
        raise ValueError(
            "The word parameter should be a string of length greater than 0."						)

    SCREAMING_SNAKE_CASE__         =    len(board[0]						)
    for i in range(__A						):
        for j in range(__A						):
            if exits_word(
                __A			,							__A			,							__A			,							__A			,							0			,							{get_point_key(__A			,							__A			,							__A			,							__A						)}						):
                return True

    return False


if __name__ == "__main__":
  import doctest

  doctest.testmod()


