


'''simple docstring'''
import os


def     a   (    __a     )						->			str:
					UpperCamelCase__     :Optional[int]							      =				len(grid[0]     )
					UpperCamelCase__     :Any							      =				len(__a     )

					UpperCamelCase__     :Any							      =				0
					UpperCamelCase__     :Union[str, Any]							      =				0
					UpperCamelCase__     :Any							      =				0

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

															UpperCamelCase__     :Optional[int]							      =				max(
															    __a				,      __a				,      __a				,      __a     )
															if max_product > largest:
																				UpperCamelCase__     :Optional[Any]							      =				max_product

					return largest


def     a   (    )						->			Tuple:
					UpperCamelCase__     :int							      =				[]
					with open(os.path.dirname(__a     ) + '''/grid.txt'''     ) as file:
										for line in file:
															grid.append(line.strip('''\n'''     ).split(''' '''     )     )

					UpperCamelCase__     :Union[str, Any]							      =				[[int(__a     ) for i in grid[j]] for j in range(len(__a     )     )]

					return largest_product(__a     )


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



'''simple docstring'''
from __future__ import annotations

from decimal import Decimal
from math import *  # noqa: F403

from sympy import diff


def     a   (    __a				,      __a				,      __a = 10**-10     )						->			float:



					'''simple docstring'''






					UpperCamelCase__     :Tuple							      =				a
					while True:
										UpperCamelCase__     :Dict							      =				Decimal(__a     ) - (
										    Decimal(eval(__a     )     ) / Decimal(eval(str(diff(__a     )     )     )     )  # noqa: S307
										)
										# This number dictates the accuracy of the answer
										if abs(eval(__a     )     ) < precision:  # noqa: S307
															return float(__a     )


# Let's Execute
if __name__ == "__main__":
		# Find root of trigonometric function
		# Find value of pi
		print(F"""The root of sin(x) = 0 is {newton_raphson('sin(x)', 2)}""")
		# Find root of polynomial
		print(F"""The root of x**2 - 5*x + 2 = 0 is {newton_raphson('x**2 - 5*x + 2', 0.4)}""")
		# Find Square Root of 5
		print(F"""The root of log(x) - 1 = 0 is {newton_raphson('log(x) - 1', 2)}""")
		# Exponential Roots
		print(F"""The root of exp(x) - 1 = 0 is {newton_raphson('exp(x) - 1', 0)}""")