

import os

def 						UpperCamelCase					(lowercase_: List[str]					)     ->      List[Any]:
	A__							:    Optional[Any]        =		len(grid[0]					)
	A__							:    Tuple        =		len(lowercase_					)

	A__							:    Union[str, Any]        =		0
	A__							:    Dict        =		0
	A__							:    Optional[Any]        =		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__							:    Any        =		grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
			A__							:    Union[str, Any]        =		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__							:    Dict        =		(
				    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__							:    Union[str, Any]        =		(
				    grid[i][j]
				    * grid[i - 1][j + 1]
				    * grid[i - 2][j + 2]
				    * grid[i - 3][j + 3]
				)

			A__							:    int        =		max(
			    lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_					)
			if max_product > largest:
				A__							:    Union[str, Any]        =		max_product

	return largest

def 						UpperCamelCase					()     ->      Any:
	A__							:    Tuple        =		[]
	with open(os.path.dirname(lowercase_					) + """/grid.txt"""					) as file:
		for line in file:
			grid.append(line.strip("""\n"""					).split(""" """					)					)

	A__							:    Any        =		[[int(lowercase_					) for i in grid[j]] for j in range(len(lowercase_					)					)]

	return largest_product(lowercase_					)


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






from math import factorial

def 						UpperCamelCase					(lowercase_: int = 20					)     ->      int:
	A__							:    Union[str, Any]        =		2 * n  # middle entry of odd rows starting at row 3 is the solution for n = 1,
	# 2, 3,...
	A__							:    Tuple        =		n // 2

	return int(factorial(lowercase_					) / (factorial(lowercase_					) * factorial(n - k					))					)


if __name__ == "__main__":
	import sys

	if len(sys.argv) == 1:
		print(solution(20))
	else:
		try:
			A_       : List[str]         =			int(sys.argv[1])
			print(solution(n))
		except ValueError:
			print('Invalid entry - please enter a number.')



