


'''simple docstring'''

from __future__ import annotations

def 							__magic_name__(  lowerCamelCase, lowerCamelCase):
						if b == 0:
												return (1, 0)
						(__lowerCAmelCase)											= extended_euclid(A__, a % b)
						__lowerCAmelCase											= a // b
						return (y, x - k * y)

def 							__magic_name__(  lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase):
						(__lowerCAmelCase)											= extended_euclid(A__, A__)
						__lowerCAmelCase											= na * na
						__lowerCAmelCase											= ra * x * na + ra * y * na
						return (n % m + m) % m

def 							__magic_name__(  lowerCamelCase, lowerCamelCase):
						(__lowerCAmelCase)											= extended_euclid(A__, A__)
						if b < 0:
												__lowerCAmelCase											= (b % n + n) % n
						return b

def 							__magic_name__(  lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase):
						__lowerCAmelCase											= invert_modulo(A__, A__), invert_modulo(A__, A__)
						__lowerCAmelCase											= na * na
						__lowerCAmelCase											= ra * x * na + ra * y * na
						return (n % m + m) % m


if __name__ == "__main__":
	from doctest import testmod

	testmod(name="""chinese_remainder_theorem""", verbose=True)
	testmod(name="""chinese_remainder_theorem2""", verbose=True)
	testmod(name="""invert_modulo""", verbose=True)
	testmod(name="""extended_euclid""", verbose=True)









"""simple docstring"""
import os

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

						UpperCAmelCase_     : Any			     =					0

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

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

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

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


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



