




import os







def 		lowercase__   (		):





					'''simple docstring'''






					with open(os.path.dirname(__A				) + '''/grid.txt'''				) as f:
										__magic_name__							:	int    							=							[]  # noqa: E741
										for _ in range(2_0				):
															l.append([int(__A				) for x in f.readline().split()]				)

										__magic_name__							:	Tuple    							=							0

										# right
										for i in range(2_0				):
															for j in range(1_7				):
																				__magic_name__							:	Dict    							=							l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
																				if temp > maximum:
																									__magic_name__							:	Tuple    							=							temp

        # down
										for i in range(1_7				):
															for j in range(2_0				):
																				__magic_name__							:	str    							=							l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
																				if temp > maximum:
																									__magic_name__							:	str    							=							temp

        # diagonal 1
										for i in range(1_7				):
															for j in range(1_7				):
																				__magic_name__							:	List[str]    							=							l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
																				if temp > maximum:
																									__magic_name__							:	int    							=							temp

        # diagonal 2
										for i in range(1_7				):
															for j in range(3							,2_0				):
																				__magic_name__							:	Any    							=							l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
																				if temp > maximum:
																									__magic_name__							:	Optional[Any]    							=							temp
										return maximum


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









import functools







def 		lowercase__   (		__A:	list[int]							,__A:	list[int]				):





					'''simple docstring'''






					if not isinstance(__A							,__A				) or not all(isinstance(__A							,__A				) for day in days				):
										raise ValueError('''The parameter days should be a list of integers'''				)

					if len(__A				) != 3 or not all(isinstance(__A							,__A				) for cost in costs				):
										raise ValueError('''The parameter costs should be a list of three integers'''				)

					if len(__A				) == 0:
										return 0

					if min(__A				) <= 0:
										raise ValueError('''All days elements should be greater than 0'''				)

					if max(__A				) >= 3_6_6:
										raise ValueError('''All days elements should be less than 366'''				)

					__magic_name__							:	Tuple    							=							set(__A				)

					@functools.cache
					def dynamic_programming(__A:	int				) -> int:
										if index > 3_6_5:
															return 0

										if index not in days_set:
															return dynamic_programming(index + 1				)

										return min(
										    costs[0] + dynamic_programming(index + 1				)							,costs[1] + dynamic_programming(index + 7				)							,costs[2] + dynamic_programming(index + 3_0				)							,)

					return dynamic_programming(1				)


if __name__ == "__main__":
	import doctest

	doctest.testmod()



