import os




def     UpperCamelCase						(	__lowercase						:			Dict     ):
		'''simple docstring'''




		A_		:    Dict         =				len(grid[0]     )
		A_		:    int         =				len(__lowercase     )

		A_		:    List[Any]         =				0
		A_		:    str         =				0
		A_		:    int         =				0

		# Check vertically, horizontally, diagonally at the same time (only works
		# for nxn grid)
		for i in range(__lowercase     ):
				for j in range(n_rows - 3     ):
						A_		:    Union[str, Any]         =				grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
						A_		:    int         =				grid[i][j] * grid[i][j + 1] * grid[i][j + 2] * grid[i][j + 3]

						# Left-to-right diagonal (\) product
						if i < n_columns - 3:
								A_		:    Optional[int]         =				(
								    grid[i][j]
								    * grid[i + 1][j + 1]
								    * grid[i + 2][j + 2]
								    * grid[i + 3][j + 3]
								)

						# Right-to-left diagonal(/) product
						if i > 2:
								A_		:    Tuple         =				(
								    grid[i][j]
								    * grid[i - 1][j + 1]
								    * grid[i - 2][j + 2]
								    * grid[i - 3][j + 3]
								)

						A_		:    Optional[Any]         =				max(
						    __lowercase						,__lowercase						,__lowercase						,__lowercase     )
						if max_product > largest:
								A_		:    Optional[Any]         =				max_product

		return largest




def     UpperCamelCase						(	):
		'''simple docstring'''




		A_		:    Optional[Any]         =				[]
		with open(os.path.dirname(__lowercase     ) + '/grid.txt'     ) as file:
				for line in file:
						grid.append(line.strip('\n'     ).split(' '     )     )

		A_		:    str         =				[[int(__lowercase     ) for i in grid[j]] for j in range(len(__lowercase     )     )]

		return largest_product(__lowercase     )


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







from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
	if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from ...utils.dummy_torch_and_transformers_objects import UnCLIPImageVariationPipeline, UnCLIPPipeline
else:
	from .pipeline_unclip import UnCLIPPipeline
	from .pipeline_unclip_image_variation import UnCLIPImageVariationPipeline
	from .text_proj import UnCLIPTextProjModel






