



import os






def      lowerCAmelCase__		(   ):





				'''simple docstring'''

				with open(os.path.dirname(lowerCamelCase__) + '''/grid.txt''') as f:
								lowerCAmelCase__					:    List[str]												=					[]  # noqa: E741
								for _ in range(20):
												l.append([int(lowerCamelCase__) for x in f.readline().split()])

								lowerCAmelCase__					:    Tuple												=					0

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

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

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

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


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






from math import factorial






def      lowerCAmelCase__		(   lowerCamelCase_		:		int = 100):





				'''simple docstring'''

				return sum(map(lowerCamelCase_	,str(factorial(lowerCamelCase_))))


if __name__ == "__main__":
							print(solution(int(input('Enter the Number: ').strip())))

