


import os






def 							__lowercase     (				__lowerCAmelCase							:       Optional[int]     ):
							a__    =  len(grid[0]     )
							a__    =  len(__lowerCAmelCase     )

							a__    =  0
							a__    =  0
							a__    =  0

							# Check vertically, horizontally, diagonally at the same time (only works
							# for nxn grid)
							for i in range(__lowerCAmelCase     ):
														for j in range(n_rows - 3     ):
																					a__    =  grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
																					a__    =  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__    =  (
																												    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__    =  (
																												    grid[i][j]
																												    * grid[i - 1][j + 1]
																												    * grid[i - 2][j + 2]
																												    * grid[i - 3][j + 3]
																												)

																					a__    =  max(
																					    __lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase     )
																					if max_product > largest:
																												a__    =  max_product

							return largest






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

							a__    =  [[int(__lowerCAmelCase     ) for i in grid[j]] for j in range(len(__lowerCAmelCase     )     )]

							return largest_product(__lowerCAmelCase     )


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




from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case							: Optional[Any]      =   {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FocalNetConfig''']}


try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						snake_case							: Optional[int]      =   [
						    '''FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''FocalNetForImageClassification''',
						    '''FocalNetForMaskedImageModeling''',
						    '''FocalNetBackbone''',
						    '''FocalNetModel''',
						    '''FocalNetPreTrainedModel''',
						]

if TYPE_CHECKING:
						from .configuration_focalnet import FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP, FocalNetConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_focalnet import (
												    FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST,
												    FocalNetBackbone,
												    FocalNetForImageClassification,
												    FocalNetForMaskedImageModeling,
												    FocalNetModel,
												    FocalNetPreTrainedModel,
												)

else:
						import sys

						snake_case							: Union[str, Any]      =   _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




