






from __future__ import annotations







def       lowercase__	(					A_:						list[list[int]]		)	->				int:







       """simple docstring"""






       for i in range(1  ,      len(matrix[0]		)		):
              matrix[0][i] += matrix[0][i - 1]

       # preprocessing the first column
       for i in range(1  ,      len(A_		)		):
              matrix[i][0] += matrix[i - 1][0]

       # updating the path cost for current position
       for i in range(1  ,      len(A_		)		):
              for j in range(1  ,      len(matrix[0]		)		):
                     matrix[i][j] += min(matrix[i - 1][j]  ,      matrix[i][j - 1]		)

       return matrix[-1][-1]


if __name__ == "__main__":
   import doctest

   doctest.testmod()






"""simple docstring"""
import os

def  lowercase     ():
						with open(os.path.dirname(_lowerCAmelCase						) + """/grid.txt"""						) as f:
												__lowerCAmelCase     =  []  # noqa: E741
												for _ in range(20						):
																		l.append([int(_lowerCAmelCase						) for x in f.readline().split()]						)

												__lowerCAmelCase     =  0

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

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

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

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


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