






import os






def 							A     (       )     ->						List[Any]:
					with open(os.path.dirname(a_					) + '/grid.txt'					) as f:
										__UpperCamelCase      :					str       		=[]  # noqa: E741
										for _ in range(20					):
															l.append([int(a_					) for x in f.readline().split()]					)

										__UpperCamelCase      :					List[Any]       		=0

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

        # down
										for i in range(17					):
															for j in range(20					):
																				__UpperCamelCase      :					Optional[int]       		=l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
																				if temp > maximum:
																									__UpperCamelCase      :					int       		=temp

        # diagonal 1
										for i in range(17					):
															for j in range(17					):
																				__UpperCamelCase      :					Tuple       		=l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
																				if temp > maximum:
																									__UpperCamelCase      :					int       		=temp

        # diagonal 2
										for i in range(17					):
															for j in range(3							,20					):
																				__UpperCamelCase      :					Optional[Any]       		=l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
																				if temp > maximum:
																									__UpperCamelCase      :					Union[str, Any]       		=temp
										return maximum


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





'''simple docstring'''


def 			snake_case_   (  SCREAMING_SNAKE_CASE__     ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE :       int     		=      0
				while len(SCREAMING_SNAKE_CASE__     ) > 1:
								_SCREAMING_SNAKE_CASE :       Any     		=      0
								# Consider two files with minimum cost to be merged
								for _ in range(2     ):
												_SCREAMING_SNAKE_CASE :       Optional[int]     		=      files.index(min(SCREAMING_SNAKE_CASE__     )     )
												temp += files[min_index]
												files.pop(SCREAMING_SNAKE_CASE__     )
								files.append(SCREAMING_SNAKE_CASE__     )
								optimal_merge_cost += temp
				return optimal_merge_cost


if __name__ == "__main__":
				import doctest

				doctest.testmod()




