






'''simple docstring'''





import os






def 				lowerCamelCase__				(_UpperCAmelCase):
			SCREAMING_SNAKE_CASE						= len(grid[0])
			SCREAMING_SNAKE_CASE						= len(_UpperCAmelCase)

			SCREAMING_SNAKE_CASE						= 0
			SCREAMING_SNAKE_CASE						= 0
			SCREAMING_SNAKE_CASE						= 0

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

									SCREAMING_SNAKE_CASE						= max(
									    _UpperCAmelCase							,       _UpperCAmelCase							,       _UpperCAmelCase							,       _UpperCAmelCase)
									if max_product > largest:
												SCREAMING_SNAKE_CASE						= max_product

			return largest






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

			SCREAMING_SNAKE_CASE						= [[int(_UpperCAmelCase) for i in grid[j]] for j in range(len(_UpperCAmelCase))]

			return largest_product(_UpperCAmelCase)


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












import os

# Precomputes a list of the 100 first triangular numbers
a_		:						str             =    [int(0.5 * n * (n + 1)) for n in range(1, 1_01)]






def 				lowerCamelCase__				():
			SCREAMING_SNAKE_CASE						= os.path.dirname(os.path.realpath(_UpperCAmelCase))
			SCREAMING_SNAKE_CASE						= os.path.join(_UpperCAmelCase							,       'words.txt')

			SCREAMING_SNAKE_CASE						= ''
			with open(_UpperCAmelCase) as f:
						SCREAMING_SNAKE_CASE						= f.readline()

			SCREAMING_SNAKE_CASE						= [word.strip('"') for word in words.strip('\r\n').split(',')]
			SCREAMING_SNAKE_CASE						= [
			    word
			    for word in [sum(ord(_UpperCAmelCase) - 64 for x in word) for word in words]
			    if word in TRIANGULAR_NUMBERS
			]
			return len(_UpperCAmelCase)


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




